Drupal 8  8.0.2
CommentLinkBuilderTest Class Reference
Inheritance diagram for CommentLinkBuilderTest:

Public Member Functions

 testCommentLinkBuilder (NodeInterface $node, $context, $has_access_comments, $history_exists, $has_post_comments, $is_anonymous, $expected)
 
 getLinkCombinations ()
 
- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Protected Member Functions

 setUp ()
 
 getMockNode ($has_field, $comment_status, $form_location, $comment_count)
 
- Protected Member Functions inherited from UnitTestCase
 setUp ()
 
 getRandomGenerator ()
 
 assertArrayEquals (array $expected, array $actual, $message=NULL)
 
 getBlockMockWithMachineName ($machine_name)
 
 getContainerWithCacheTagsInvalidator (CacheTagsInvalidatorInterface $cache_tags_validator)
 
 getClassResolverStub ()
 

Protected Attributes

 $commentManager
 
 $stringTranslation
 
 $entityManager
 
 $moduleHandler
 
 $currentUser
 
 $timestamp
 
 $commentLinkBuilder
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Detailed Description

comment

Member Function Documentation

getLinkCombinations ( )

Data provider for ::testCommentLinkBuilder.

References CommentItemInterface\CLOSED, CommentItemInterface\FORM_BELOW, CommentItemInterface\FORM_SEPARATE_PAGE, Url\fromRoute(), TestBase\generatePermutations(), CommentLinkBuilderTest\getMockNode(), CommentItemInterface\HIDDEN, and CommentItemInterface\OPEN.

Here is the call graph for this function:

getMockNode (   $has_field,
  $comment_status,
  $form_location,
  $comment_count 
)
protected

Builds a mock node based on given scenario.

Parameters
bool$has_fieldTRUE if the node has the 'comment' field.
int$comment_statusOne of CommentItemInterface::OPEN|HIDDEN|CLOSED
int$form_locationOne of CommentItemInterface::FORM_BELOW|FORM_SEPARATE_PAGE
int$comment_countNumber of comments against the field.
Returns
| Mock node for testing.

References Url\fromRoute().

Referenced by CommentLinkBuilderTest\getLinkCombinations().

Here is the call graph for this function:

Here is the caller graph for this function:

setUp ( )
protected

Prepares mocks for the test.

References Drupal\currentUser(), Drupal\entityManager(), UnitTestCase\getStringTranslationStub(), and Drupal\moduleHandler().

Here is the call graph for this function:

testCommentLinkBuilder ( NodeInterface  $node,
  $context,
  $has_access_comments,
  $history_exists,
  $has_post_comments,
  $is_anonymous,
  $expected 
)

Test the buildCommentedEntityLinks method.

Parameters
\Drupal\node\NodeInterface | \PHPUnit_Framework_MockObject_MockObject$nodeMock node.
array$contextContext for the links.
bool$has_access_commentsTRUE if the user has 'access comments' permission.
bool$history_existsTRUE if the history module exists.
bool$has_post_commentsTRUE if the use has 'post comments' permission.
bool$is_anonymousTRUE if the user is anonymous.
array$expectedArray of expected links keyed by link ID. Can be either string (link title) or array of link properties.

getLinkCombinations

::buildCommentedEntityLinks

References Drupal\currentUser(), and Drupal\moduleHandler().

Here is the call graph for this function:


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