diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index ee63bfa..ea86fad 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -293,7 +293,8 @@ public function build(ContainerBuilder $container) { $container->register('flood', 'Drupal\Core\Flood\DatabaseBackend') ->addArgument(new Reference('database')); - $container->register('plugin.manager.condition', 'Drupal\Core\Condition\ConditionManager'); + $container->register('plugin.manager.condition', 'Drupal\Core\Condition\ConditionManager') + ->addArgument('%container.namespaces%'); $container->register('kernel_destruct_subscriber', 'Drupal\Core\EventSubscriber\KernelDestructionSubscriber') ->addMethodCall('setContainer', array(new Reference('service_container'))) diff --git a/core/modules/php/lib/Drupal/php/Tests/Condition/PhpConditionTest.php b/core/modules/php/lib/Drupal/php/Tests/Condition/PhpConditionTest.php index 32f1f75..13c339a 100644 --- a/core/modules/php/lib/Drupal/php/Tests/Condition/PhpConditionTest.php +++ b/core/modules/php/lib/Drupal/php/Tests/Condition/PhpConditionTest.php @@ -8,7 +8,6 @@ namespace Drupal\php\Tests\Condition; use Drupal\simpletest\DrupalUnitTestBase; -use Drupal\Core\Condition\ConditionManager; /** * Tests the php condition. @@ -22,11 +21,13 @@ class PhpConditionTest extends DrupalUnitTestBase { */ protected $manager; - public static $modules = array('system', 'php'); - /** - * Defines test information. + * Modules to enable. + * + * @var array */ + public static $modules = array('system', 'php'); + public static function getInfo() { return array( 'name' => 'PHP Condition Plugin', @@ -35,41 +36,38 @@ public static function getInfo() { ); } - /** - * Sets up the tests. - */ protected function setUp() { parent::setUp(); - $this->manager = new ConditionManager($this->container->getParameter('container.namespaces')); + $this->manager = $this->container->get('plugin.manager.condition'); } /** * Tests conditions. */ public function testConditions() { - // Grab the php condition and configure it to check against a php snippet. + // Grab the PHP condition and configure it to check against a php snippet. $condition = $this->manager->createInstance('php') ->setConfig('php', ''); - $this->assertTRUE($condition->execute(), 'PHP condition passes as expected.'); + $this->assertTrue($condition->execute(), 'PHP condition passes as expected.'); // Check for the proper summary. - $this->assertEqual('When the given PHP evaluates as TRUE.', $condition->summary()); + $this->assertEqual($condition->summary(), 'When the given PHP evaluates as TRUE.'); - // Set the php snippet to return FALSE. + // Set the PHP snippet to return FALSE. $condition->setConfig('php', ''); $this->assertFalse($condition->execute(), 'PHP condition fails as expected.'); // Negate the condition. $condition->setConfig('negate', TRUE); // Check for the proper summary. - $this->assertEqual('When the given PHP evaluates as FALSE.', $condition->summary()); + $this->assertEqual($condition->summary(), 'When the given PHP evaluates as FALSE.'); // Reverse the negation. $condition->setConfig('negate', FALSE); // Set and empty snippet. $condition->setConfig('php', FALSE); // Check for the proper summary. - $this->assertEqual('No PHP code has been provided.', $condition->summary()); + $this->assertEqual($condition->summary(), 'No PHP code has been provided.'); } }