function StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php \Drupal\Tests\Component\Plugin\Discovery\StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback()
  2. 8.9.x core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php \Drupal\Tests\Component\Plugin\Discovery\StaticDiscoveryDecoratorTest::getRegisterDefinitionsCallback()
  3. 10 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 29

Class

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

Namespace

Drupal\Tests\Component\Plugin\Discovery

Code

public function getRegisterDefinitionsCallback() {
    $mock_callable = $this->createMock(StaticDiscoveryDecoratorTestMockInterface::class);
    // Set expectations for the callback method.
    $mock_callable->expects($this->once())
        ->method('registerDefinitionsCallback');
    return $mock_callable;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.