Browse Source

Tests, coding standards

pull/747/head
dannylamb 6 years ago
parent
commit
766a6433c6
  1. 5
      islandora.module
  2. 8
      tests/src/Functional/JsonldSelfReferenceReactionTest.php
  3. 4
      tests/src/Functional/JsonldTypeAlterReactionTest.php

5
islandora.module

@ -14,6 +14,7 @@
* @author Diego Pino Navarro <dpino@metro.org> https://github.com/diegopino
*/
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
@ -259,8 +260,8 @@ function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array
$context['cacheability']->addCacheTags($context_config->getCacheTags());
};
}
catch (Drupal\Component\Plugin\Exception\PluginNotFoundException $e) {
// Squash :(
catch (PluginNotFoundException $e) {
// Squash :(.
}
}
}

8
tests/src/Functional/JsonldSelfReferenceReactionTest.php

@ -98,6 +98,10 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$this->assertSession()
->pageTextContains("The context $context_name has been saved");
// The first time a Context is saved, you need to clear the cache.
// Subsequent changes to the context don't need a cache rebuild, though.
drupal_flush_all_caches();
$new_contents = $this->drupalGet($url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$this->assertEquals(
@ -177,6 +181,10 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$this->assertSession()
->pageTextContains("The context $context_name has been saved");
// The first time a Context is saved, you need to clear the cache.
// Subsequent changes to the context don't need a cache rebuild, though.
drupal_flush_all_caches();
$new_contents = $this->drupalGet($media_url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$this->assertEquals(

4
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -75,6 +75,10 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
$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'));
// The first time a Context is saved, you need to clear the cache.
// Subsequent changes to the context don't need a cache rebuild, though.
drupal_flush_all_caches();
// Check for the new @type from the field_type_predicate value.
$new_contents = $this->drupalGet($url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);

Loading…
Cancel
Save