Browse Source

#1470 Move entity_bundle context plugin to islandora_entity_bundle to avoid ctools

pull/772/head
Jonathan Hunt 6 years ago
parent
commit
81716a1d8c
  1. 6
      src/Plugin/Condition/EntityBundle.php
  2. 10
      tests/src/Functional/EntityBundleTest.php
  3. 2
      tests/src/Functional/JsonldTypeAlterReactionTest.php

6
src/Plugin/Condition/EntityBundle.php

@ -8,8 +8,10 @@ use Drupal\Core\Form\FormStateInterface;
/** /**
* Provides a 'Entity Bundle' condition. * Provides a 'Entity Bundle' condition.
* *
* Namespaced to avoid conflict with ctools entity_bundle plugin.
*
* @Condition( * @Condition(
* id = "entity_bundle", * id = "islandora_entity_bundle",
* label = @Translation("Entity Bundle"), * label = @Translation("Entity Bundle"),
* context_definitions = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")),
@ -18,7 +20,7 @@ use Drupal\Core\Form\FormStateInterface;
* } * }
* ) * )
*/ */
class EntityBundle extends ConditionPluginBase { class IslandoraEntityBundle extends ConditionPluginBase {
/** /**
* {@inheritdoc} * {@inheritdoc}

10
tests/src/Functional/EntityBundleTest.php

@ -7,12 +7,12 @@ namespace Drupal\Tests\islandora\Functional;
* *
* @group islandora * @group islandora
*/ */
class EntityBundleTest extends IslandoraFunctionalTestBase { class IslandoraEntityBundleTest extends IslandoraFunctionalTestBase {
/** /**
* @covers \Drupal\islandora\Plugin\Condition\EntityBundle::buildConfigurationForm * @covers \Drupal\islandora\Plugin\Condition\IslandoraEntityBundle::buildConfigurationForm
* @covers \Drupal\islandora\Plugin\Condition\EntityBundle::submitConfigurationForm * @covers \Drupal\islandora\Plugin\Condition\IslandoraEntityBundle::submitConfigurationForm
* @covers \Drupal\islandora\Plugin\Condition\EntityBundle::evaluate * @covers \Drupal\islandora\Plugin\Condition\IslandoraEntityBundle::evaluate
*/ */
public function testEntityBundleType() { public function testEntityBundleType() {
// Create a test user. // Create a test user.
@ -24,7 +24,7 @@ class EntityBundleTest extends IslandoraFunctionalTestBase {
$this->drupalLogin($account); $this->drupalLogin($account);
$this->createContext('Test', 'test'); $this->createContext('Test', 'test');
$this->addCondition('test', 'entity_bundle'); $this->addCondition('test', 'islandora_entity_bundle');
$this->getSession()->getPage()->checkField("edit-conditions-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->checkField("edit-conditions-entity-bundle-bundles-test-type");
$this->getSession()->getPage()->findById("edit-conditions-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton(t('Save and continue')); $this->getSession()->getPage()->pressButton(t('Save and continue'));

2
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -70,7 +70,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
$this->assertSession() $this->assertSession()
->pageTextContains("The context $context_name has been saved"); ->pageTextContains("The context $context_name has been saved");
$this->addCondition('test', 'entity_bundle'); $this->addCondition('test', 'islandora_entity_bundle');
$this->getSession()->getPage()->checkField("edit-conditions-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->checkField("edit-conditions-entity-bundle-bundles-test-type");
$this->getSession()->getPage()->findById("edit-conditions-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton(t('Save and continue')); $this->getSession()->getPage()->pressButton(t('Save and continue'));

Loading…
Cancel
Save