Browse Source

Tests use strings not translateable markup to select interface buttons.

pull/1007/head
Rosie Le Faive 10 months ago
parent
commit
3784def287
  1. 6
      modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
  2. 6
      modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
  3. 6
      modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
  4. 2
      tests/src/Functional/ContentEntityTypeTest.php
  5. 2
      tests/src/Functional/DerivativeReactionTest.php
  6. 2
      tests/src/Functional/EmitNodeEventTest.php
  7. 2
      tests/src/Functional/EntityBundleTest.php
  8. 2
      tests/src/Functional/FormDisplayAlterReactionTest.php
  9. 2
      tests/src/Functional/IndexingTest.php
  10. 10
      tests/src/Functional/IslandoraSettingsFormTest.php
  11. 2
      tests/src/Functional/JsonldSelfReferenceReactionTest.php
  12. 12
      tests/src/Functional/JsonldTypeAlterReactionTest.php

6
modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php

@ -40,7 +40,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a audio derivative. // Create an action to generate a audio derivative.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative");
$this->getSession()->getPage()->pressButton($this->t('Create')); $this->getSession()->getPage()->pressButton('Create');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative");
@ -53,7 +53,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-f mp3"); $this->getSession()->getPage()->fillField('edit-args', "-f mp3");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.mov"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov");
$this->getSession()->getPage()->pressButton($this->t('Save')); $this->getSession()->getPage()->pressButton('Save');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -69,7 +69,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save')); $this->submitForm($values, 'Save');
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

6
modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php

@ -42,7 +42,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a jpeg thumbnail. // Create an action to generate a jpeg thumbnail.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate an image derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate an image derivative");
$this->getSession()->getPage()->pressButton($this->t('Create')); $this->getSession()->getPage()->pressButton('Create');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate image test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate image test derivative");
@ -55,7 +55,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20"); $this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.jpeg"); $this->getSession()->getPage()->fillField('edit-path', "derp.jpeg");
$this->getSession()->getPage()->pressButton($this->t('Save')); $this->getSession()->getPage()->pressButton('Save');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -71,7 +71,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save')); $this->submitForm($values, 'Save');
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

6
modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php

@ -37,7 +37,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a jpeg thumbnail. // Create an action to generate a jpeg thumbnail.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a video derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a video derivative");
$this->getSession()->getPage()->pressButton($this->t('Create')); $this->getSession()->getPage()->pressButton('Create');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate video test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate video test derivative");
@ -50,7 +50,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-f mp4"); $this->getSession()->getPage()->fillField('edit-args', "-f mp4");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.mov"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov");
$this->getSession()->getPage()->pressButton($this->t('Save')); $this->getSession()->getPage()->pressButton('Save');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -66,7 +66,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save')); $this->submitForm($values, 'Save');
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

2
tests/src/Functional/ContentEntityTypeTest.php

@ -39,7 +39,7 @@ class ContentEntityTypeTest extends IslandoraFunctionalTestBase {
$this->addCondition('test', 'content_entity_type'); $this->addCondition('test', 'content_entity_type');
$this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node"); $this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node");
$this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton($this->t('Save and continue')); $this->getSession()->getPage()->pressButton('Save and continue');
$this->addPresetReaction('test', 'index', 'hello_world'); $this->addPresetReaction('test', 'index', 'hello_world');
// Create a new node confirm Hello World! is printed to the screen. // Create a new node confirm Hello World! is printed to the screen.

2
tests/src/Functional/DerivativeReactionTest.php

@ -53,7 +53,7 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase {
'field_media_of[0][target_id]' => 'Test Node', 'field_media_of[0][target_id]' => 'Test Node',
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save')); $this->submitForm($values, 'Save');
// field_media_of is set and there's a file, so derivatives should fire. // field_media_of is set and there's a file, so derivatives should fire.
$this->assertSession()->pageTextContains("Hello World!"); $this->assertSession()->pageTextContains("Hello World!");

2
tests/src/Functional/EmitNodeEventTest.php

@ -44,7 +44,7 @@ class EmitNodeEventTest extends IslandoraFunctionalTestBase {
$this->addCondition('test', 'content_entity_type'); $this->addCondition('test', 'content_entity_type');
$this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node"); $this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node");
$this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton($this->t('Save and continue')); $this->getSession()->getPage()->pressButton('Save and continue');
$this->addPresetReaction('test', 'index', $action_id); $this->addPresetReaction('test', 'index', $action_id);
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);

2
tests/src/Functional/EntityBundleTest.php

@ -27,7 +27,7 @@ class EntityBundleTest extends IslandoraFunctionalTestBase {
$this->addCondition('test', 'islandora_entity_bundle'); $this->addCondition('test', 'islandora_entity_bundle');
$this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type");
$this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton($this->t('Save and continue')); $this->getSession()->getPage()->pressButton('Save and continue');
$this->addPresetReaction('test', 'index', 'hello_world'); $this->addPresetReaction('test', 'index', 'hello_world');
// Create a new test_type confirm Hello World! is printed to the screen. // Create a new test_type confirm Hello World! is printed to the screen.

2
tests/src/Functional/FormDisplayAlterReactionTest.php

@ -49,7 +49,7 @@ class FormDisplayAlterReactionTest extends IslandoraFunctionalTestBase {
$this->drupalGet("admin/structure/context/test/reaction/add/form_display_alter"); $this->drupalGet("admin/structure/context/test/reaction/add/form_display_alter");
$this->getSession()->getPage()->findById("edit-reactions-form-display-alter-mode")->selectOption('node.secondary'); $this->getSession()->getPage()->findById("edit-reactions-form-display-alter-mode")->selectOption('node.secondary');
$this->getSession()->getPage()->pressButton($this->t('Save and continue')); $this->getSession()->getPage()->pressButton('Save and continue');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
drupal_flush_all_caches(); drupal_flush_all_caches();

2
tests/src/Functional/IndexingTest.php

@ -66,7 +66,7 @@ class IndexingTest extends IslandoraFunctionalTestBase {
$this->drupalGet("$url/delete"); $this->drupalGet("$url/delete");
// Delete the node. // Delete the node.
$this->submitForm([], $this->t('Delete')); $this->submitForm([], 'Delete');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Confirm Goodbye, Cruel World! is printed to the screen. // Confirm Goodbye, Cruel World! is printed to the screen.

10
tests/src/Functional/IslandoraSettingsFormTest.php

@ -38,23 +38,23 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase {
$this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour'); $this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour');
$this->drupalGet('/admin/config/islandora/core'); $this->drupalGet('/admin/config/islandora/core');
// Blank is not allowed. // Blank is not allowed.
$this->submitForm(['edit-jwt-expiry' => ""], $this->t('Save configuration')); $this->submitForm(['edit-jwt-expiry' => ""], 'Save configuration');
$this->assertSession()->pageTextContainsOnce('"" is not a valid time or interval expression.'); $this->assertSession()->pageTextContainsOnce('"" is not a valid time or interval expression.');
$this->drupalGet('/admin/config/islandora/core'); $this->drupalGet('/admin/config/islandora/core');
// Negative is not allowed. // Negative is not allowed.
$this->submitForm(['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration')); $this->submitForm(['edit-jwt-expiry' => "-2 hours"], 'Save configuration');
$this->assertSession()->pageTextContainsOnce('Time or interval expression cannot be negative'); $this->assertSession()->pageTextContainsOnce('Time or interval expression cannot be negative');
$this->drupalGet('/admin/config/islandora/core'); $this->drupalGet('/admin/config/islandora/core');
// Must include an integer value. // Must include an integer value.
$this->submitForm(['edit-jwt-expiry' => "last hour"], $this->t('Save configuration')); $this->submitForm(['edit-jwt-expiry' => "last hour"], 'Save configuration');
$this->assertSession()->pageTextContainsOnce('No numeric interval specified, for example "1 day"'); $this->assertSession()->pageTextContainsOnce('No numeric interval specified, for example "1 day"');
$this->drupalGet('/admin/config/islandora/core'); $this->drupalGet('/admin/config/islandora/core');
// Must have an accepted interval. // Must have an accepted interval.
$this->submitForm(['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration')); $this->submitForm(['edit-jwt-expiry' => "1 fortnight"], 'Save configuration');
$this->assertSession()->pageTextContainsOnce('No time interval found, please include one of'); $this->assertSession()->pageTextContainsOnce('No time interval found, please include one of');
$this->drupalGet('/admin/config/islandora/core'); $this->drupalGet('/admin/config/islandora/core');
// Test a valid setting. // Test a valid setting.
$this->submitForm(['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration')); $this->submitForm(['edit-jwt-expiry' => "2 weeks"], 'Save configuration');
$this->assertSession()->pageTextContainsOnce('The configuration options have been saved.'); $this->assertSession()->pageTextContainsOnce('The configuration options have been saved.');
} }

2
tests/src/Functional/JsonldSelfReferenceReactionTest.php

@ -60,7 +60,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$this->postNodeAddForm('test_type', $this->postNodeAddForm('test_type',
['title[0][value]' => 'Test Node'], ['title[0][value]' => 'Test Node'],
$this->t('Save')); 'Save');
$this->assertSession()->pageTextContains("Test Node"); $this->assertSession()->pageTextContains("Test Node");
$url = $this->getUrl(); $url = $this->getUrl();

12
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -32,7 +32,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
'label' => 'Typed Predicate', 'label' => 'Typed Predicate',
'field_name' => 'type_predicate', 'field_name' => 'type_predicate',
], 'Save and continue'); ], 'Save and continue');
$this->submitForm([], $this->t('Save field settings')); $this->submitForm([], 'Save field settings');
} }
else { else {
$this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text');
@ -46,7 +46,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
'new_storage_type' => 'plain_text', 'new_storage_type' => 'plain_text',
'label' => 'Typed Predicate', 'label' => 'Typed Predicate',
'field_name' => 'type_predicate', 'field_name' => 'type_predicate',
], $this->t('Continue')); ], 'Continue');
// Now we can proceed, selecting the plain text (i.e. string) // Now we can proceed, selecting the plain text (i.e. string)
// for the second element now that the element is displayed after // for the second element now that the element is displayed after
@ -57,16 +57,16 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
'label' => 'Typed Predicate', 'label' => 'Typed Predicate',
'field_name' => 'type_predicate', 'field_name' => 'type_predicate',
'group_field_options_wrapper' => 'string', 'group_field_options_wrapper' => 'string',
], $this->t('Continue')); ], 'Continue');
} }
$this->submitForm([], $this->t('Save settings')); $this->submitForm([], 'Save settings');
$this->assertSession()->responseContains('field_type_predicate'); $this->assertSession()->responseContains('field_type_predicate');
// Add the test node. // Add the test node.
$this->postNodeAddForm('test_type', [ $this->postNodeAddForm('test_type', [
'title[0][value]' => 'Test Node', 'title[0][value]' => 'Test Node',
'field_type_predicate[0][value]' => 'schema:Organization', 'field_type_predicate[0][value]' => 'schema:Organization',
], $this->t('Save')); ], 'Save');
$this->assertSession()->pageTextContains("Test Node"); $this->assertSession()->pageTextContains("Test Node");
$url = $this->getUrl(); $url = $this->getUrl();
@ -103,7 +103,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
$this->addCondition('test', 'islandora_entity_bundle'); $this->addCondition('test', 'islandora_entity_bundle');
$this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type");
$this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); $this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node");
$this->getSession()->getPage()->pressButton($this->t('Save and continue')); $this->getSession()->getPage()->pressButton('Save and continue');
// The first time a Context is saved, you need to clear the cache. // 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. // Subsequent changes to the context don't need a cache rebuild, though.

Loading…
Cancel
Save