public function ModuleHandlerTest::testCachedGetImplementations 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::testCachedGetImplementations()
Test getImplementations.
@covers ::getImplementations @covers ::getImplementationInfo
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 326 - Contains \Drupal\Tests\Core\Extension\ModuleHandlerTest.
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @group Extension
Namespace
Drupal\Tests\Core\ExtensionCode
public function testCachedGetImplementations() {
$this->cacheBackend
->expects($this
->exactly(1))
->method('get')
->will($this
->onConsecutiveCalls((object) array(
'data' => array(
'hook' => array(
'module_handler_test' => 'test',
),
),
)));
// 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',
'loadInclude',
))
->getMock();
$module_handler
->expects($this
->never())
->method('buildImplementationInfo');
$module_handler
->expects($this
->once())
->method('loadInclude');
$this
->assertEquals(array(
'module_handler_test',
), $module_handler
->getImplementations('hook'));
}