// Set the plugin manager to support getMigrationDependencies().
$plugin_manager = $this->createMock('Drupal\migrate\Plugin\MigrationPluginManagerInterface'); $migration->setMigrationPluginManager($plugin_manager); $plugin_manager->expects($this->exactly(2)) ->method('expandPluginIds') ->willReturnArgument(0);
$this->commentManager->expects($this->any()) ->method('getFields') ->with('node') ->willReturn([ 'comment' => [], ]); $this->commentManager->expects($this->any()) ->method('forbiddenMessage') ->willReturn("Can't let you do that Dave."); $this->stringTranslation->expects($this->any()) ->method('formatPlural') ->willReturnArgument(1); }
/**
* Tests the buildCommentedEntityLinks method.
*
* @param \Drupal\node\NodeInterface|\PHPUnit\Framework\MockObject\MockObject $node
* Mock node.
* @param array $context
* Context for the links.
* @param bool $has_access_comments
* TRUE if the user has 'access comments' permission.
* @param bool $history_exists
* TRUE if the history module exists.
* @param bool $has_post_comments
* TRUE if the use has 'post comments' permission.
* @param bool $is_anonymous
* TRUE if the user is anonymous.
* @param array $expected
* Array of expected links keyed by link ID. Can be either string (link
* title) or array of link properties.
*
* @dataProvider getLinkCombinations
*
* @covers ::buildCommentedEntityLinks
*/
$fakePutMessageOnQueue = $this->createMock(MiddlewareInterface::class); $fakePutMessageOnQueue->expects($this->any()) ->method('handle') ->with($this->callback(function D$envelope)use($messageBusAfterQueue){ // Fake putting the message on the queue
// Fake reading the queue
// Now, we add the message back to a new bus.
$messageBusAfterQueue->dispatch($envelope);
/**
* Tests the isValid() method without the 'link to any page' permission.
*
* @covers ::isValid
*/ publicfunctiontestIsValidWithoutLinkToAnyPageAccount(){ $this->account->expects($this->once())
/**
* Tests bubbling of assets when NOT using #pre_render callbacks.
*/ publicfunctiontestBubblingWithoutPreRender(){ $this->setUpRequest(); $this->setupMemoryCache();
// Create an element with a child and subchild. Each element loads a
// different library using #attached.
$element = [ '#type' => 'container', '#cache' => [ 'keys' => ['test', 'renderer', 'children_attached'], ], '#attached' => ['library' => ['test/parent']], '#title' => 'Parent', ];