Skip to content

Commit

Permalink
Using context_definitions annotation instead of the deprecated contex… (
Browse files Browse the repository at this point in the history
  • Loading branch information
dannylamb authored Mar 25, 2020
1 parent 1b2ab9e commit e9bea0d
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -85,16 +86,25 @@ public function setUp() {
]);
$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'),
]
);
}

/**
* @covers \Drupal\islandora_breadcrumbs\IslandoraBreadcrumbBuilder::applies
*/
public function testDefaults() {
$breadcrumbs = [
$this->nodeC->toUrl()->toString() => $this->nodeC->label(),
$this->nodeB->toUrl()->toString() => $this->nodeB->label(),
Url::fromRoute('<front>')->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);

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/ContentEntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @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")),
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/EntityBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @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"))
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/FileUsesFilesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @Condition(
* id = "file_uses_filesystem",
* label = @Translation("File uses filesystem"),
* context = {
* context_definitions = {
* "file" = @ContextDefinition("entity:file", required = TRUE , label = @Translation("file"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/MediaHasTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @Condition(
* id = "media_has_term",
* label = @Translation("Media has term with URI"),
* context = {
* context_definitions = {
* "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/MediaUsesFilesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Condition(
* id = "media_uses_filesystem",
* label = @Translation("Media uses filesystem"),
* context = {
* context_definitions = {
* "media" = @ContextDefinition("entity:media", required = TRUE , label = @Translation("media"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/NodeHadNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @Condition(
* id = "node_had_namespace",
* label = @Translation("Node had 7.x namespace"),
* context = {
* context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/NodeHasParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @Condition(
* id = "node_has_parent",
* label = @Translation("Node has parent"),
* context = {
* context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/NodeHasTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @Condition(
* id = "node_has_term",
* label = @Translation("Node has term with URI"),
* context = {
* context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/NodeIsPublished.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @Condition(
* id = "node_is_published",
* label = @Translation("Node is published"),
* context = {
* context_definitions = {
* "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
* }
* )
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Condition/ParentNodeHasTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @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"))
* }
* )
Expand Down

0 comments on commit e9bea0d

Please sign in to comment.