diff --git a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php index 043055b..2bd7910 100644 --- a/core/lib/Drupal/Core/Condition/ConditionPluginBase.php +++ b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php @@ -42,6 +42,11 @@ public function buildForm(array $form, array &$form_state) { } /** + * Implements \Drupal\Core\Form\FormInterface::validateForm(). + */ + public function validateForm(array &$form, array &$form_state) {} + + /** * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ public function submitForm(array &$form, array &$form_state) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php index 888f1e6..c22f222 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php @@ -93,8 +93,8 @@ function testContext() { $plugin->setContextValue('user', $node); $this->fail('The node context should fail validation for a user context.'); } - catch (ContextException $e) { - $this->assertEqual($e->getMessage(), 'The context passed was not an instance of Drupal\user\Plugin\Core\Entity\User.'); + catch (PluginException $e) { + $this->assertEqual($e->getMessage(), 'The provided context value does not pass validation.'); } // Set an appropriate context value appropriately and check to make sure @@ -157,13 +157,8 @@ function testContext() { } // With no contexts set, try to get the context values. - try { - $complex_plugin->getContextValues(); - $this->fail('There should not be any contexts set yet.'); - } - catch (PluginException $e) { - $this->assertEqual($e->getMessage(), 'There are no set contexts.'); - } + $values = $complex_plugin->getContextValues(); + $this->assertIdentical(array_filter($values), array(), 'There are no set contexts.'); // Set the user context value. $complex_plugin->setContextValue('user', $user); @@ -178,13 +173,9 @@ function testContext() { } // With only the user context set, try to get the context values. - try { - $complex_plugin->getContextValues(); - $this->fail('The node context should not yet be set.'); - } - catch (PluginException $e) { - $this->assertEqual($e->getMessage(), 'The node context is not yet set.'); - } + $values = $complex_plugin->getContextValues(); + $this->assertNull($values['node'], 'The node context is not yet set.'); + $this->assertNotNull($values['user'], 'The user context is set'); $complex_plugin->setContextValue('node', $node); $context_wrappers = $complex_plugin->getContexts();