diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php index 6f4075d..b139c88 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php @@ -215,7 +215,7 @@ function testManipulations() { ); } - $manager = new ImageToolkitManager($this->container->get('container.namespaces')); + $manager = new ImageToolkitManager($this->container->get('container.namespaces'), $this->container->get('cache.cache'), $this->container->get('language_manager'), $this->container->get('module_handler')); foreach ($files as $file) { foreach ($operations as $op => $values) { // Load up a fresh image. diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php index d0d64a3..4314d72 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php @@ -26,7 +26,7 @@ public static function getInfo() { * available toolkits. */ function testGetAvailableToolkits() { - $manager = new ImageToolkitManager($this->container->get('container.namespaces')); + $manager = new ImageToolkitManager($this->container->get('container.namespaces'), $this->container->get('cache.cache'), $this->container->get('language_manager'), $this->container->get('module_handler')); $toolkits = $manager->getAvailableToolkits(); $this->assertTrue(isset($toolkits['test']), 'The working toolkit was returned.'); $this->assertFalse(isset($toolkits['broken']), 'The toolkit marked unavailable was not returned'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php index 260b2da..c191cad 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php @@ -31,7 +31,7 @@ function setUp() { parent::setUp(); // Use the image_test.module's test toolkit. - $manager = new ImageToolkitManager($this->container->get('container.namespaces')); + $manager = new ImageToolkitManager($this->container->get('container.namespaces'), $this->container->get('cache.cache'), $this->container->get('language_manager'), $this->container->get('module_handler')); $this->toolkit = $manager->createInstance('test'); // Pick a file for testing. diff --git a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php index b1012c2..3e42efc 100644 --- a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php +++ b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php @@ -33,7 +33,7 @@ public function getFormID() { * Constructs a \Drupal\condition_test\FormController object. */ public function __construct() { - $manager = new ConditionManager(\Drupal::service('container.namespaces')); + $manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('cache'), \Drupal::service('language_manager'), \Drupal::moduleHandler()); $this->condition = $manager->createInstance('node_type'); } diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index b771fa1..6397640 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -51,7 +51,7 @@ public static function getInfo() { ); } - function setUp() { + public function setUp() { $this->expectedDefinitions = array( 'apple' => array( 'id' => 'apple', @@ -76,15 +76,16 @@ function setUp() { /** * Tests the plugin manager with no cache and altering. */ - function testDefaultPluginManager() { + public function testDefaultPluginManager() { $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); + $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); } /** * Tests the plugin manager with no cache and altering. */ - function testDefaultPluginManagerWithAlter() { + public function testDefaultPluginManagerWithAlter() { $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandler'); // Configure the stub. @@ -97,12 +98,13 @@ function testDefaultPluginManagerWithAlter() { $plugin_manager->setAlterHook($module_handler, $alter_hook_name); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); + $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); } /** * Tests the plugin manager with caching and altering. */ - function testDefaultPluginManagerWithEmptyCache() { + public function testDefaultPluginManagerWithEmptyCache() { $cid = $this->randomName(); $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend') ->disableOriginalConstructor() @@ -128,12 +130,13 @@ function testDefaultPluginManagerWithEmptyCache() { $plugin_manager->setCache($cache_backend, $language_manager, $cid); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); + $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); } /** * Tests the plugin manager with caching and altering. */ - function testDefaultPluginManagerWithFilledCache() { + public function testDefaultPluginManagerWithFilledCache() { $cid = $this->randomName(); $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend') ->disableOriginalConstructor() diff --git a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php index 0f97c00..cc23350 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php +++ b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php @@ -42,11 +42,11 @@ public function __construct(\Traversable $namespaces, $definitions) { * @param \Drupal\Core\Extension\ModuleHandler $module_handler * The module handler to invoke the alter hook with. * @param string $alter_hook - * (optional) Name of the alter hook. Defaults to $owner_$type if not given. + * Name of the alter hook. Defaults to $owner_$type if not given. */ - public function setAlterHook(ModuleHandlerInterface $module_handler, $alter_hook = NULL) { + public function setAlterHook(ModuleHandlerInterface $module_handler, $alter_hook) { $this->moduleHandler = $module_handler; - $this->alterHook = $alter_hook ? $alter_hook : strtolower($this->subdir); + $this->alterHook = $alter_hook; } } diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php index 36cd94e..08d8871 100644 --- a/core/tests/bootstrap.php +++ b/core/tests/bootstrap.php @@ -1,7 +1,5 @@ add('Drupal\\', __DIR__);