Drupal 8  8.0.2
CommentTestBase Class Reference
Inheritance diagram for CommentTestBase:

Public Member Functions

 postComment ($entity, $comment, $subject= '', $contact=NULL, $field_name= 'comment')
 
 commentExists (CommentInterface $comment=NULL, $reply=FALSE)
 
 deleteComment (CommentInterface $comment)
 
 setCommentSubject ($enabled)
 
 setCommentPreview ($mode, $field_name= 'comment')
 
 setCommentForm ($enabled, $field_name= 'comment')
 
 setCommentAnonymous ($level)
 
 setCommentsPerPage ($number, $field_name= 'comment')
 
 setCommentSettings ($name, $value, $message, $field_name= 'comment')
 
 commentContactInfoAvailable ()
 
 performCommentOperation (CommentInterface $comment, $operation, $approval=FALSE)
 
 getUnapprovedComment ($subject)
 
- Public Member Functions inherited from WebTestBase
 __construct ($test_id=NULL)
 
 drupalGetNodeByTitle ($title, $reset=FALSE)
 
- Public Member Functions inherited from TestBase
 __construct ($test_id=NULL)
 
 run (array $methods=array())
 
 errorHandler ($severity, $message, $file=NULL, $line=NULL)
 
 configImporter ()
 
 copyConfig (StorageInterface $source_storage, StorageInterface $target_storage)
 
 getDatabasePrefix ()
 
 getTempFilesDirectory ()
 

Static Public Attributes

static $modules = ['block', 'comment', 'node', 'history', 'field_ui', 'datetime']
 

Protected Member Functions

 setUp ()
 
 createCommentType ($label)
 
- Protected Member Functions inherited from WebTestBase
 drupalCreateNode (array $settings=array())
 
 drupalCreateContentType (array $values=array())
 
 drupalBuildEntityView (EntityInterface $entity, $view_mode= 'full', $langcode=NULL, $reset=FALSE)
 
 drupalPlaceBlock ($plugin_id, array $settings=array())
 
 assertBlockAppears (Block $block)
 
 assertNoBlockAppears (Block $block)
 
 findBlockInstance (Block $block)
 
 drupalGetTestFiles ($type, $size=NULL)
 
 drupalCompareFiles ($file1, $file2)
 
 drupalLogin (AccountInterface $account)
 
 drupalUserIsLoggedIn ($account)
 
 drupalLogout ()
 
 setUp ()
 
 doInstall ()
 
 prepareSettings ()
 
 initSettings ()
 
 initConfig (ContainerInterface $container)
 
 rebuildAll ()
 
 installParameters ()
 
 setBatch ()
 
 restoreBatch ()
 
 initUserSession ()
 
 initKernel (Request $request)
 
 addCustomTranslations ($langcode, array $values)
 
 writeCustomTranslations ()
 
 rebuildContainer ()
 
 resetAll ()
 
 refreshVariables ()
 
 tearDown ()
 
 curlInitialize ()
 
 curlExec ($curl_options, $redirect=FALSE)
 
 curlHeaderCallback ($curlHandler, $header)
 
 curlClose ()
 
 isInChildSite ()
 
 drupalGet ($path, array $options=array(), array $headers=array())
 
 drupalGetJSON ($path, array $options=array(), array $headers=array())
 
 drupalGetWithFormat ($path, $format, array $options=[], array $headers=[])
 
 drupalGetAjax ($path, array $options=array(), array $headers=array())
 
 drupalGetXHR ($path, array $options=array(), array $headers=array())
 
 drupalPostForm ($path, $edit, $submit, array $options=array(), array $headers=array(), $form_html_id=NULL, $extra_post=NULL)
 
 drupalPostAjaxForm ($path, $edit, $triggering_element, $ajax_path=NULL, array $options=array(), array $headers=array(), $form_html_id=NULL, $ajax_settings=NULL)
 
 drupalProcessAjaxResponse ($content, array $ajax_response, array $ajax_settings, array $drupal_settings)
 
 drupalPost ($path, $accept, array $post, $options=array())
 
 drupalPostWithFormat ($path, $format, array $post, $options=[])
 
 getAjaxPageStatePostData ()
 
 serializePostValues ($post=array())
 
 translatePostValues (array $values)
 
 cronRun ()
 
 checkForMetaRefresh ()
 
 drupalHead ($path, array $options=array(), array $headers=array())
 
 handleForm (&$post, &$edit, &$upload, $submit, $form)
 
 clickLink ($label, $index=0)
 
 clickLinkPartialName ($label, $index=0)
 
 clickLinkHelper ($label, $index, $pattern)
 
 getAbsoluteUrl ($path)
 
 drupalGetHeaders ($all_requests=FALSE)
 
 drupalGetHeader ($name, $all_requests=FALSE)
 
 assertHeader ($header, $value, $message= '', $group= 'Browser')
 
 drupalGetMails ($filter=array())
 
 assertUrl ($path, array $options=array(), $message= '', $group= 'Other')
 
 assertResponse ($code, $message= '', $group= 'Browser')
 
 assertNoResponse ($code, $message= '', $group= 'Browser')
 
 assertMail ($name, $value= '', $message= '', $group= 'Email')
 
 assertMailString ($field_name, $string, $email_depth, $message= '', $group= 'Other')
 
 assertMailPattern ($field_name, $regex, $message= '', $group= 'Other')
 
 verboseEmail ($count=1)
 
 prepareRequestForGenerator ($clean_urls=TRUE, $override_server_vars=array())
 
 buildUrl ($path, array $options=array())
 
 assertCacheContext ($expected_cache_context)
 
 assertNoCacheContext ($not_expected_cache_context)
 
 assertCacheTag ($expected_cache_tag)
 
 assertNoCacheTag ($cache_tag)
 
 setHttpResponseDebugCacheabilityHeaders ($value=TRUE)
 
- Protected Member Functions inherited from TestBase
 setUp ()
 
 checkRequirements ()
 
 storeAssertion (array $assertion)
 
 assert ($status, $message= '', $group= 'Other', array $caller=NULL)
 
 getAssertionCall ()
 
 assertTrue ($value, $message= '', $group= 'Other')
 
 assertFalse ($value, $message= '', $group= 'Other')
 
 assertNull ($value, $message= '', $group= 'Other')
 
 assertNotNull ($value, $message= '', $group= 'Other')
 
 assertEqual ($first, $second, $message= '', $group= 'Other')
 
 assertNotEqual ($first, $second, $message= '', $group= 'Other')
 
 assertIdentical ($first, $second, $message= '', $group= 'Other')
 
 assertNotIdentical ($first, $second, $message= '', $group= 'Other')
 
 assertIdenticalObject ($object1, $object2, $message= '', $group= 'Other')
 
 assertNoErrorsLogged ()
 
 assertErrorLogged ($error_message)
 
 pass ($message=NULL, $group= 'Other')
 
 fail ($message=NULL, $group= 'Other')
 
 error ($message= '', $group= 'Other', array $caller=NULL)
 
 verbose ($message)
 
 beforePrepareEnvironment ()
 
 tearDown ()
 
 exceptionHandler ($exception)
 
 settingsSet ($name, $value)
 
 config ($name)
 
 getConfigSchemaExclusions ()
 

Protected Attributes

 $adminUser
 
 $webUser
 
 $node
 
- Protected Attributes inherited from WebTestBase
 $profile = 'testing'
 
 $url
 
 $curlHandle
 
 $assertAjaxHeader = TRUE
 
 $headers
 
 $cookies = array()
 
 $dumpHeaders = FALSE
 
 $loggedInUser = FALSE
 
 $rootUser
 
 $cookieFile = NULL
 
 $additionalCurlOptions = array()
 
 $originalBatch
 
 $originalUser = NULL
 
 $originalShutdownCallbacks = array()
 
 $sessionId = NULL
 
 $generatedTestFiles = FALSE
 
 $maximumRedirects = 5
 
 $redirectCount
 
 $maximumMetaRefreshCount = NULL
 
 $metaRefreshCount = 0
 
 $kernel
 
 $configDirectories = array()
 
 $curlCookies = array()
 
 $customTranslations
 
 $classLoader
 
- Protected Attributes inherited from TestBase
 $testId
 
 $siteDirectory = NULL
 
 $databasePrefix = NULL
 
 $timeLimit = 500
 
 $assertions = array()
 
 $skipClasses = array(__CLASS__ => TRUE)
 
 $verboseId = 0
 
 $verboseClassName
 
 $verboseDirectory
 
 $verboseDirectoryUrl
 
 $originalConf
 
 $originalConfig
 
 $originalConfigDirectories
 
 $originalContainer
 
 $originalFileDirectory = NULL
 
 $originalLanguage
 
 $originalPrefix
 
 $originalProfile
 
 $originalSessionName
 
 $originalSettings
 
 $originalShutdownCallbacks
 
 $originalSite
 
 $originalUser
 
 $publicFilesDirectory
 
 $privateFilesDirectory
 
 $tempFilesDirectory
 
 $translationFilesDirectory
 
 $kernel
 
 $container
 
 $configImporter
 
 $strictConfigSchema = TRUE
 
 $httpAuthMethod = CURLAUTH_BASIC
 
 $httpAuthCredentials = NULL
 

Additional Inherited Members

- Static Public Member Functions inherited from TestBase
static insertAssert ($test_id, $test_class, $status, $message= '', $group= 'Other', array $caller=array())
 
static deleteAssert ($message_id)
 
static getDatabaseConnection ()
 
static generatePermutations ($parameters)
 
static filePreDeleteCallback ($path)
 
- Data Fields inherited from WebTestBase
createRole as drupalCreateRole
 
createAdminRole as drupalCreateAdminRole
 
- Data Fields inherited from TestBase
 $results
 
 $verbose
 
 $dieOnFail = FALSE
 
- Static Protected Attributes inherited from TestBase
static $configSchemaCheckerExclusions
 

Detailed Description

Provides setup and helper methods for comment tests.

Member Function Documentation

commentContactInfoAvailable ( )

Checks whether the commenter's contact information is displayed.

Returns
bool Contact info is available.

Referenced by CommentAnonymousTest\testAnonymous().

Here is the caller graph for this function:

commentExists ( CommentInterface  $comment = NULL,
  $reply = FALSE 
)

Checks current page for specified comment.

Parameters
\Drupal\comment\CommentInterface$commentThe comment object.
bool$replyBoolean indicating whether the comment is a reply to another comment.
Returns
bool Boolean indicating whether the comment was found.

Referenced by CommentAnonymousTest\testAnonymous(), CommentAdminTest\testApprovalAdminInterface(), CommentAdminTest\testApprovalNodeInterface(), CommentInterfaceTest\testAutoFilledSubject(), CommentInterfaceTest\testCommentInterface(), CommentPagerTest\testCommentPaging(), CommentTitleTest\testCommentPopulatedTitles(), CommentThreadingTest\testCommentThreading(), and CommentNodeAccessTest\testThreadedCommentView().

Here is the caller graph for this function:

createCommentType (   $label)
protected

Creates a comment comment type (bundle).

Parameters
string$labelThe comment type label.
Returns
Created comment type.

References Entity\create().

Referenced by CommentTypeTest\testCommentTypeCreation(), and CommentTypeTest\testCommentTypeDeletion().

Here is the call graph for this function:

Here is the caller graph for this function:

deleteComment ( CommentInterface  $comment)

Deletes a comment.

Parameters
\Drupal\comment\CommentInterface$commentComment to delete.

References WebTestBase\drupalPostForm(), EntityInterface\id(), and t().

Referenced by CommentInterfaceTest\testCommentInterface().

Here is the call graph for this function:

Here is the caller graph for this function:

getUnapprovedComment (   $subject)

Gets the comment ID for an unapproved comment.

Parameters
string$subjectComment subject to find.
Returns
int Comment id.

References WebTestBase\drupalGet().

Referenced by CommentAdminTest\testApprovalAdminInterface(), and CommentAdminTest\testApprovalNodeInterface().

Here is the call graph for this function:

Here is the caller graph for this function:

performCommentOperation ( CommentInterface  $comment,
  $operation,
  $approval = FALSE 
)

Performs the specified operation on the specified comment.

Parameters
\Drupal\comment\CommentInterface$commentComment to perform operation on.
string$operationOperation to perform.
bool$approvalOperation is found on approval page.

References WebTestBase\drupalPostForm(), format_string(), EntityInterface\id(), t(), and Drupal\translation().

Referenced by CommentAnonymousTest\testAnonymous(), and CommentAdminTest\testApprovalAdminInterface().

Here is the call graph for this function:

Here is the caller graph for this function:

postComment (   $entity,
  $comment,
  $subject = '',
  $contact = NULL,
  $field_name = 'comment' 
)

Posts a comment.

Parameters
\Drupal\Core\Entity\EntityInterface | null$entityNode to post comment on or NULL to post to the previously loaded page.
string$commentComment body.
string$subjectComment subject.
string$contactSet to NULL for no contact info, TRUE to ignore success checking, and array of values to set contact info.
string$field_name(optional) Field name through which the comment should be posted. Defaults to 'comment'.
Returns
|null The posted comment or NULL when posted comment was not found.

References TestBase\assertTrue(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), Drupal\entityManager(), Entity\load(), FieldConfig\loadByName(), and t().

Referenced by CommentAnonymousTest\testAnonymous(), CommentAdminTest\testApprovalAdminInterface(), CommentAdminTest\testApprovalNodeInterface(), CommentInterfaceTest\testAutoFilledSubject(), CommentTitleTest\testCommentEmptyTitles(), CommentFieldsTest\testCommentFieldLinksNonDefaultName(), CommentFieldsTest\testCommentInstallAfterContentModule(), CommentInterfaceTest\testCommentInterface(), CommentLinksAlterTest\testCommentLinksAlter(), CommentPagerTest\testCommentNewPageIndicator(), CommentStatisticsTest\testCommentNodeCommentStatistics(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentTitleTest\testCommentPopulatedTitles(), CommentActionsTest\testCommentPublishUnpublishActions(), CommentRssTest\testCommentRss(), CommentThreadingTest\testCommentThreading(), CommentTokenReplaceTest\testCommentTokenReplacement(), CommentActionsTest\testCommentUnpublishByKeyword(), CommentAdminTest\testEditComment(), CommentNodeChangesTest\testNodeDeletion(), CommentBlockTest\testRecentCommentBlock(), CommentNodeAccessTest\testThreadedCommentView(), and CommentPagerTest\testTwoPagers().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentAnonymous (   $level)

Sets the value governing restrictions on anonymous comments.

Parameters
int$levelThe level of the contact information allowed for anonymous comments:
  • 0: No contact information allowed.
  • 1: Contact information allowed but not required.
  • 2: Contact information required.

References format_string(), and CommentTestBase\setCommentSettings().

Referenced by CommentAnonymousTest\testAnonymous(), CommentAdminTest\testApprovalAdminInterface(), CommentAdminTest\testApprovalNodeInterface(), CommentLinksTest\testCommentLinks(), CommentStatisticsTest\testCommentNodeCommentStatistics(), and CommentAdminTest\testEditComment().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentForm (   $enabled,
  $field_name = 'comment' 
)

Sets the value governing whether the comment form is on its own page.

Parameters
bool$enabledTRUE if the comment form should be displayed on the same page as the comments; FALSE if it should be displayed on its own page.
string$field_name(optional) Field name through which the comment should be posted. Defaults to 'comment'.

References CommentItemInterface\FORM_BELOW, CommentItemInterface\FORM_SEPARATE_PAGE, and CommentTestBase\setCommentSettings().

Referenced by CommentInterfaceTest\setUp(), CommentTitleTest\testCommentEmptyTitles(), CommentInterfaceTest\testCommentInterface(), CommentPagerTest\testCommentNewPageIndicator(), CommentStatisticsTest\testCommentNodeCommentStatistics(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentTitleTest\testCommentPopulatedTitles(), CommentPreviewTest\testCommentPreview(), CommentPreviewTest\testCommentPreviewDuplicateSubmission(), CommentThreadingTest\testCommentThreading(), CommentNodeAccessTest\testThreadedCommentView(), and CommentPagerTest\testTwoPagers().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentPreview (   $mode,
  $field_name = 'comment' 
)

Sets the value governing the previewing mode for the comment form.

Parameters
int$modeThe preview mode: DRUPAL_DISABLED, DRUPAL_OPTIONAL or DRUPAL_REQUIRED.
string$field_name(optional) Field name through which the comment should be posted. Defaults to 'comment'.

References format_string(), and CommentTestBase\setCommentSettings().

Referenced by CommentInterfaceTest\setUp(), CommentTitleTest\testCommentEmptyTitles(), CommentInterfaceTest\testCommentInterface(), CommentPagerTest\testCommentNewPageIndicator(), CommentStatisticsTest\testCommentNodeCommentStatistics(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentTitleTest\testCommentPopulatedTitles(), CommentPreviewTest\testCommentPreview(), CommentPreviewTest\testCommentPreviewDuplicateSubmission(), CommentThreadingTest\testCommentThreading(), CommentNodeAccessTest\testThreadedCommentView(), and CommentPagerTest\testTwoPagers().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentSettings (   $name,
  $value,
  $message,
  $field_name = 'comment' 
)

Sets a comment settings variable for the article content type.

Parameters
string$nameName of variable.
string$valueValue of variable.
string$messageStatus message to display.
string$field_name(optional) Field name through which the comment should be posted. Defaults to 'comment'.

References FieldConfig\loadByName(), and TestBase\pass().

Referenced by CommentTestBase\setCommentAnonymous(), CommentTestBase\setCommentForm(), CommentTestBase\setCommentPreview(), CommentTestBase\setCommentsPerPage(), CommentInterfaceTest\setUp(), CommentLinksTest\testCommentLinks(), CommentPagerTest\testCommentNewPageIndicator(), CommentStatisticsTest\testCommentNodeCommentStatistics(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentPreviewTest\testCommentPreview(), CommentPreviewTest\testCommentPreviewDuplicateSubmission(), CommentThreadingTest\testCommentThreading(), CommentNodeAccessTest\testThreadedCommentView(), and CommentPagerTest\testTwoPagers().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentsPerPage (   $number,
  $field_name = 'comment' 
)

Sets the value specifying the default number of comments per page.

Parameters
int$numberComments per page value.
string$field_name(optional) Field name through which the comment should be posted. Defaults to 'comment'.

References format_string(), and CommentTestBase\setCommentSettings().

Referenced by CommentInterfaceTest\testCommentInterface(), CommentPagerTest\testCommentNewPageIndicator(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentBlockTest\testRecentCommentBlock(), and CommentPagerTest\testTwoPagers().

Here is the call graph for this function:

Here is the caller graph for this function:

setCommentSubject (   $enabled)

Sets the value governing whether the subject field should be enabled.

Parameters
bool$enabledBoolean specifying whether the subject field should be enabled.

References TestBase\pass().

Referenced by CommentInterfaceTest\setUp(), CommentTitleTest\testCommentEmptyTitles(), CommentInterfaceTest\testCommentInterface(), CommentPagerTest\testCommentNewPageIndicator(), CommentStatisticsTest\testCommentNodeCommentStatistics(), CommentPagerTest\testCommentOrderingThreading(), CommentPagerTest\testCommentPaging(), CommentTitleTest\testCommentPopulatedTitles(), CommentPreviewTest\testCommentPreview(), CommentPreviewTest\testCommentPreviewDuplicateSubmission(), CommentThreadingTest\testCommentThreading(), CommentTokenReplaceTest\testCommentTokenReplacement(), and CommentNodeAccessTest\testThreadedCommentView().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: