public function ModuleHandlerTest::testCachedGetImplementationsMissingMethod in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testCachedGetImplementationsMissingMethod()
Test getImplementations.
@covers ::getImplementations @covers ::getImplementationInfo
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 358 - Contains \Drupal\Tests\Core\Extension\ModuleHandlerTest.
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @group Extension
Namespace
Drupal\Tests\Core\ExtensionCode
public function testCachedGetImplementationsMissingMethod() {
$this->cacheBackend
->expects($this
->exactly(1))
->method('get')
->will($this
->onConsecutiveCalls((object) array(
'data' => array(
'hook' => array(
'module_handler_test' => array(),
'module_handler_test_missing' => array(),
),
),
)));
// Ensure buildImplementationInfo doesn't get called and that we work off cached results.
$module_handler = $this
->getMockBuilder('Drupal\\Core\\Extension\\ModuleHandler')
->setConstructorArgs(array(
$this->root,
array(
'module_handler_test' => array(
'type' => 'module',
'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
'filename' => 'module_handler_test.module',
),
),
$this->cacheBackend,
))
->setMethods(array(
'buildImplementationInfo',
))
->getMock();
$module_handler
->expects($this
->never())
->method('buildImplementationInfo');
$this
->assertEquals(array(
'module_handler_test',
), $module_handler
->getImplementations('hook'));
}