You are here

public function StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php \Drupal\Tests\Component\Plugin\Discovery\StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback()

Helper method to provide a mocked callback object with expectations.

If there should be a registered definition, then we have to place a \Callable in the mock object. The return value of this callback is never used.

Return value

\PHPUnit\Framework\MockObject\MockObject Mocked object with expectation of registerDefinitionsCallback() being called once.

2 calls to StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback()
StaticDiscoveryDecoratorTest::testGetDefinition in core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@covers ::getDefinition @dataProvider providerGetDefinition
StaticDiscoveryDecoratorTest::testGetDefinitions in core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@covers ::getDefinitions @dataProvider providerGetDefinitions

File

core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php, line 24

Class

StaticDiscoveryDecoratorTest
@group Plugin @coversDefaultClass \Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator

Namespace

Drupal\Tests\Component\Plugin\Discovery

Code

public function getRegisterDefinitionsCallback() {
  $mock_callable = $this
    ->getMockBuilder('\\stdClass')
    ->setMethods([
    'registerDefinitionsCallback',
  ])
    ->getMock();

  // Set expectations for the callback method.
  $mock_callable
    ->expects($this
    ->once())
    ->method('registerDefinitionsCallback');
  return $mock_callable;
}