Browse Source

Using context_definitions annotation instead of the deprecated contex… (#764)

pull/766/head
dannylamb 5 years ago committed by GitHub
parent
commit
e9bea0d697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .travis.yml
  2. 14
      modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php
  3. 2
      src/Plugin/Condition/ContentEntityType.php
  4. 2
      src/Plugin/Condition/EntityBundle.php
  5. 2
      src/Plugin/Condition/FileUsesFilesystem.php
  6. 2
      src/Plugin/Condition/MediaHasTerm.php
  7. 2
      src/Plugin/Condition/MediaUsesFilesystem.php
  8. 2
      src/Plugin/Condition/NodeHadNamespace.php
  9. 2
      src/Plugin/Condition/NodeHasParent.php
  10. 2
      src/Plugin/Condition/NodeHasTerm.php
  11. 2
      src/Plugin/Condition/NodeIsPublished.php
  12. 2
      src/Plugin/Condition/ParentNodeHasTerm.php

8
.travis.yml

@ -27,12 +27,12 @@ install:
- $SCRIPT_DIR/travis_setup_drupal.sh - $SCRIPT_DIR/travis_setup_drupal.sh
- git -C "$TRAVIS_BUILD_DIR" checkout -b travis-testing - git -C "$TRAVIS_BUILD_DIR" checkout -b travis-testing
- cd $DRUPAL_DIR; - 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 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 - 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 - cd web
- (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 --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults
- drush -y --uri=127.0.0.1:8282 en islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video - drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults
- (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)
script: script:
- $SCRIPT_DIR/travis_scripts.sh - $SCRIPT_DIR/travis_scripts.sh

14
modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php

@ -2,6 +2,7 @@
namespace Drupal\Tests\islandora_breadcrumbs\Functional; namespace Drupal\Tests\islandora_breadcrumbs\Functional;
use Drupal\Core\Url;
use Drupal\Tests\islandora\Functional\IslandoraFunctionalTestBase; use Drupal\Tests\islandora\Functional\IslandoraFunctionalTestBase;
use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait; 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->set('field_member_of', [$this->nodeC->id()]);
$this->nodeD->save(); $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() { public function testDefaults() {
$breadcrumbs = [ $breadcrumbs = [
$this->nodeC->toUrl()->toString() => $this->nodeC->label(), Url::fromRoute('<front>')->toString() => 'Home',
$this->nodeB->toUrl()->toString() => $this->nodeB->label(),
$this->nodeA->toUrl()->toString() => $this->nodeA->label(), $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); $this->assertBreadcrumb($this->nodeD->toUrl()->toString(), $breadcrumbs);

2
src/Plugin/Condition/ContentEntityType.php

@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface;
* @Condition( * @Condition(
* id = "content_entity_type", * id = "content_entity_type",
* label = @Translation("Content Entity Type"), * label = @Translation("Content Entity Type"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")),
* "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")), * "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")),
* "file" = @ContextDefinition("entity:file", required = FALSE, label = @Translation("File")), * "file" = @ContextDefinition("entity:file", required = FALSE, label = @Translation("File")),

2
src/Plugin/Condition/EntityBundle.php

@ -11,7 +11,7 @@ use Drupal\Core\Form\FormStateInterface;
* @Condition( * @Condition(
* id = "entity_bundle", * id = "entity_bundle",
* label = @Translation("Entity Bundle"), * label = @Translation("Entity Bundle"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")),
* "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")), * "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")),
* "taxonomy_term" = @ContextDefinition("entity:taxonomy_term", required = FALSE, label = @Translation("Term")) * "taxonomy_term" = @ContextDefinition("entity:taxonomy_term", required = FALSE, label = @Translation("Term"))

2
src/Plugin/Condition/FileUsesFilesystem.php

@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "file_uses_filesystem", * id = "file_uses_filesystem",
* label = @Translation("File uses filesystem"), * label = @Translation("File uses filesystem"),
* context = { * context_definitions = {
* "file" = @ContextDefinition("entity:file", required = TRUE , label = @Translation("file")) * "file" = @ContextDefinition("entity:file", required = TRUE , label = @Translation("file"))
* } * }
* ) * )

2
src/Plugin/Condition/MediaHasTerm.php

@ -8,7 +8,7 @@ namespace Drupal\islandora\Plugin\Condition;
* @Condition( * @Condition(
* id = "media_has_term", * id = "media_has_term",
* label = @Translation("Media has term with URI"), * label = @Translation("Media has term with URI"),
* context = { * context_definitions = {
* "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media"))
* } * }
* ) * )

2
src/Plugin/Condition/MediaUsesFilesystem.php

@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "media_uses_filesystem", * id = "media_uses_filesystem",
* label = @Translation("Media uses filesystem"), * label = @Translation("Media uses filesystem"),
* context = { * context_definitions = {
* "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media"))
* } * }
* ) * )

2
src/Plugin/Condition/NodeHadNamespace.php

@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "node_had_namespace", * id = "node_had_namespace",
* label = @Translation("Node had 7.x namespace"), * label = @Translation("Node had 7.x namespace"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* } * }
* ) * )

2
src/Plugin/Condition/NodeHasParent.php

@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "node_has_parent", * id = "node_has_parent",
* label = @Translation("Node has parent"), * label = @Translation("Node has parent"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* } * }
* ) * )

2
src/Plugin/Condition/NodeHasTerm.php

@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "node_has_term", * id = "node_has_term",
* label = @Translation("Node has term with URI"), * label = @Translation("Node has term with URI"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* } * }
* ) * )

2
src/Plugin/Condition/NodeIsPublished.php

@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @Condition( * @Condition(
* id = "node_is_published", * id = "node_is_published",
* label = @Translation("Node is published"), * label = @Translation("Node is published"),
* context = { * context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node")) * "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* } * }
* ) * )

2
src/Plugin/Condition/ParentNodeHasTerm.php

@ -8,7 +8,7 @@ namespace Drupal\islandora\Plugin\Condition;
* @Condition( * @Condition(
* id = "parent_node_has_term", * id = "parent_node_has_term",
* label = @Translation("Parent node for media has term with URI"), * label = @Translation("Parent node for media has term with URI"),
* context = { * context_definitions = {
* "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media")) * "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media"))
* } * }
* ) * )

Loading…
Cancel
Save