From e9bea0d697000d6f6f2a6a2d8d672ca0e49f134a Mon Sep 17 00:00:00 2001 From: dannylamb Date: Wed, 25 Mar 2020 12:01:07 -0600 Subject: [PATCH] =?UTF-8?q?Using=20context=5Fdefinitions=20annotation=20in?= =?UTF-8?q?stead=20of=20the=20deprecated=20contex=E2=80=A6=20(#764)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 8 ++++---- .../tests/src/Functional/BreadcrumbsTest.php | 14 ++++++++++++-- src/Plugin/Condition/ContentEntityType.php | 2 +- src/Plugin/Condition/EntityBundle.php | 2 +- src/Plugin/Condition/FileUsesFilesystem.php | 2 +- src/Plugin/Condition/MediaHasTerm.php | 2 +- src/Plugin/Condition/MediaUsesFilesystem.php | 2 +- src/Plugin/Condition/NodeHadNamespace.php | 2 +- src/Plugin/Condition/NodeHasParent.php | 2 +- src/Plugin/Condition/NodeHasTerm.php | 2 +- src/Plugin/Condition/NodeIsPublished.php | 2 +- src/Plugin/Condition/ParentNodeHasTerm.php | 2 +- 12 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5321085..b0dcc8ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,12 +27,12 @@ install: - $SCRIPT_DIR/travis_setup_drupal.sh - git -C "$TRAVIS_BUILD_DIR" checkout -b travis-testing - cd $DRUPAL_DIR; + - chmod -R u+w web/sites/default - COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 $COMPOSER_PATH config repositories.local path "$TRAVIS_BUILD_DIR" - COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 $COMPOSER_PATH require "islandora/islandora:dev-travis-testing as dev-8.x-1.x" --prefer-source --update-with-dependencies - - cd web; drush --uri=127.0.0.1:8282 en -y islandora - - (drush -y --uri=127.0.0.1:8282 en islandora_core_feature; drush -y --uri=127.0.0.1:8282 fim islandora_core_feature) - - drush -y --uri=127.0.0.1:8282 en islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video - - (drush -y --uri=127.0.0.1:8282 en islandora_text_extraction_defaults; drush -y --uri=127.0.0.1:8282 fim islandora_text_extraction_defaults) + - cd web + - drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults + - drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults script: - $SCRIPT_DIR/travis_scripts.sh diff --git a/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php b/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php index c95d362c..18fa030e 100644 --- a/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php +++ b/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\islandora_breadcrumbs\Functional; +use Drupal\Core\Url; use Drupal\Tests\islandora\Functional\IslandoraFunctionalTestBase; use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait; @@ -85,6 +86,14 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase { ]); $this->nodeD->set('field_member_of', [$this->nodeC->id()]); $this->nodeD->save(); + + $this->drupalPlaceBlock( + 'system_breadcrumb_block', + [ + 'region' => 'content', + 'theme' => $this->config('system.theme')->get('default'), + ] + ); } /** @@ -92,9 +101,10 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase { */ public function testDefaults() { $breadcrumbs = [ - $this->nodeC->toUrl()->toString() => $this->nodeC->label(), - $this->nodeB->toUrl()->toString() => $this->nodeB->label(), + Url::fromRoute('')->toString() => 'Home', $this->nodeA->toUrl()->toString() => $this->nodeA->label(), + $this->nodeB->toUrl()->toString() => $this->nodeB->label(), + $this->nodeC->toUrl()->toString() => $this->nodeC->label(), ]; $this->assertBreadcrumb($this->nodeD->toUrl()->toString(), $breadcrumbs); diff --git a/src/Plugin/Condition/ContentEntityType.php b/src/Plugin/Condition/ContentEntityType.php index 71379f94..e80eee42 100644 --- a/src/Plugin/Condition/ContentEntityType.php +++ b/src/Plugin/Condition/ContentEntityType.php @@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface; * @Condition( * id = "content_entity_type", * label = @Translation("Content Entity Type"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")), * "file" = @ContextDefinition("entity:file", required = FALSE, label = @Translation("File")), diff --git a/src/Plugin/Condition/EntityBundle.php b/src/Plugin/Condition/EntityBundle.php index 13500f68..4803fd49 100644 --- a/src/Plugin/Condition/EntityBundle.php +++ b/src/Plugin/Condition/EntityBundle.php @@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface; * @Condition( * id = "entity_bundle", * label = @Translation("Entity Bundle"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")), * "taxonomy_term" = @ContextDefinition("entity:taxonomy_term", required = FALSE, label = @Translation("Term")) diff --git a/src/Plugin/Condition/FileUsesFilesystem.php b/src/Plugin/Condition/FileUsesFilesystem.php index a5fc32f5..27e120e8 100644 --- a/src/Plugin/Condition/FileUsesFilesystem.php +++ b/src/Plugin/Condition/FileUsesFilesystem.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "file_uses_filesystem", * label = @Translation("File uses filesystem"), - * context = { + * context_definitions = { * "file" = @ContextDefinition("entity:file", required = TRUE , label = @Translation("file")) * } * ) diff --git a/src/Plugin/Condition/MediaHasTerm.php b/src/Plugin/Condition/MediaHasTerm.php index b170c7a6..f56a85ce 100644 --- a/src/Plugin/Condition/MediaHasTerm.php +++ b/src/Plugin/Condition/MediaHasTerm.php @@ -8,7 +8,7 @@ namespace Drupal\islandora\Plugin\Condition; * @Condition( * id = "media_has_term", * label = @Translation("Media has term with URI"), - * context = { + * context_definitions = { * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * } * ) diff --git a/src/Plugin/Condition/MediaUsesFilesystem.php b/src/Plugin/Condition/MediaUsesFilesystem.php index cb69a301..769e6c6d 100644 --- a/src/Plugin/Condition/MediaUsesFilesystem.php +++ b/src/Plugin/Condition/MediaUsesFilesystem.php @@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "media_uses_filesystem", * label = @Translation("Media uses filesystem"), - * context = { + * context_definitions = { * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * } * ) diff --git a/src/Plugin/Condition/NodeHadNamespace.php b/src/Plugin/Condition/NodeHadNamespace.php index b1d1efe0..4872f7eb 100644 --- a/src/Plugin/Condition/NodeHadNamespace.php +++ b/src/Plugin/Condition/NodeHadNamespace.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "node_had_namespace", * label = @Translation("Node had 7.x namespace"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * } * ) diff --git a/src/Plugin/Condition/NodeHasParent.php b/src/Plugin/Condition/NodeHasParent.php index ca5703ec..5002707f 100644 --- a/src/Plugin/Condition/NodeHasParent.php +++ b/src/Plugin/Condition/NodeHasParent.php @@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "node_has_parent", * label = @Translation("Node has parent"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * } * ) diff --git a/src/Plugin/Condition/NodeHasTerm.php b/src/Plugin/Condition/NodeHasTerm.php index 1f501fde..8558e14b 100644 --- a/src/Plugin/Condition/NodeHasTerm.php +++ b/src/Plugin/Condition/NodeHasTerm.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "node_has_term", * label = @Translation("Node has term with URI"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * } * ) diff --git a/src/Plugin/Condition/NodeIsPublished.php b/src/Plugin/Condition/NodeIsPublished.php index 1b81270d..54466df4 100644 --- a/src/Plugin/Condition/NodeIsPublished.php +++ b/src/Plugin/Condition/NodeIsPublished.php @@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @Condition( * id = "node_is_published", * label = @Translation("Node is published"), - * context = { + * context_definitions = { * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * } * ) diff --git a/src/Plugin/Condition/ParentNodeHasTerm.php b/src/Plugin/Condition/ParentNodeHasTerm.php index 3bc08641..d14f1292 100644 --- a/src/Plugin/Condition/ParentNodeHasTerm.php +++ b/src/Plugin/Condition/ParentNodeHasTerm.php @@ -8,7 +8,7 @@ namespace Drupal\islandora\Plugin\Condition; * @Condition( * id = "parent_node_has_term", * label = @Translation("Parent node for media has term with URI"), - * context = { + * context_definitions = { * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * } * )