From e30cdbf6812febe2b38e8d22020c2fc352f28638 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 09:44:50 -0400 Subject: [PATCH 1/9] Update testing drupal and php versions --- .github/workflows/build-2.x.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 2ab3a539e..4750ba4de 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -23,10 +23,10 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ["8.1", "8.2"] + php-versions: ["8.1", "8.2", "8.3"] # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. test-suite: ["kernel", "functional", "functional-javascript"] - drupal-version: ["10.0.x", "10.1.x", "10.2.x-dev"] + drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] mysql: ["8.0"] allowed_failure: [false] From 3784def28765a08f6df616aa9fb91731000dccd5 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:03:10 -0400 Subject: [PATCH 2/9] Tests use strings not translateable markup to select interface buttons. --- .../src/Functional/GenerateAudioDerivativeTest.php | 6 +++--- .../src/Functional/GenerateImageDerivativeTest.php | 6 +++--- .../src/Functional/GenerateVideoDerivativeTest.php | 6 +++--- tests/src/Functional/ContentEntityTypeTest.php | 2 +- tests/src/Functional/DerivativeReactionTest.php | 2 +- tests/src/Functional/EmitNodeEventTest.php | 2 +- tests/src/Functional/EntityBundleTest.php | 2 +- .../src/Functional/FormDisplayAlterReactionTest.php | 2 +- tests/src/Functional/IndexingTest.php | 2 +- tests/src/Functional/IslandoraSettingsFormTest.php | 10 +++++----- .../Functional/JsonldSelfReferenceReactionTest.php | 2 +- tests/src/Functional/JsonldTypeAlterReactionTest.php | 12 ++++++------ 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php index 6b85cd1b5..094a7856a 100644 --- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php +++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php @@ -40,7 +40,7 @@ public function testGenerateAudioDerivativeFromScratch() { // Create an action to generate a audio derivative. $this->drupalGet('admin/config/system/actions'); $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->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative"); @@ -53,7 +53,7 @@ public function testGenerateAudioDerivativeFromScratch() { $this->getSession()->getPage()->fillField('edit-args', "-f mp3"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -69,7 +69,7 @@ public function testGenerateAudioDerivativeFromScratch() { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php index 44cdda589..17c1beae0 100644 --- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php +++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php @@ -42,7 +42,7 @@ public function testGenerateImageDerivativeFromScratch() { // Create an action to generate a jpeg thumbnail. $this->drupalGet('admin/config/system/actions'); $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->getSession()->getPage()->fillField('edit-label', "Generate image test derivative"); @@ -55,7 +55,7 @@ public function testGenerateImageDerivativeFromScratch() { $this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.jpeg"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -71,7 +71,7 @@ public function testGenerateImageDerivativeFromScratch() { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php index de06ba2f7..2f79e18e9 100644 --- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php +++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php @@ -37,7 +37,7 @@ public function testGenerateVideoDerivativeFromScratch() { // Create an action to generate a jpeg thumbnail. $this->drupalGet('admin/config/system/actions'); $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->getSession()->getPage()->fillField('edit-label', "Generate video test derivative"); @@ -50,7 +50,7 @@ public function testGenerateVideoDerivativeFromScratch() { $this->getSession()->getPage()->fillField('edit-args', "-f mp4"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -66,7 +66,7 @@ public function testGenerateVideoDerivativeFromScratch() { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/tests/src/Functional/ContentEntityTypeTest.php b/tests/src/Functional/ContentEntityTypeTest.php index 5ed229486..b753852ac 100644 --- a/tests/src/Functional/ContentEntityTypeTest.php +++ b/tests/src/Functional/ContentEntityTypeTest.php @@ -39,7 +39,7 @@ public function testContentEntityType() { $this->addCondition('test', 'content_entity_type'); $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()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', 'hello_world'); // Create a new node confirm Hello World! is printed to the screen. diff --git a/tests/src/Functional/DerivativeReactionTest.php b/tests/src/Functional/DerivativeReactionTest.php index 00e0e5ae5..7c0cedb35 100644 --- a/tests/src/Functional/DerivativeReactionTest.php +++ b/tests/src/Functional/DerivativeReactionTest.php @@ -53,7 +53,7 @@ public function testExecuteDerivativeReaction() { 'field_media_of[0][target_id]' => 'Test Node', ]; $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. $this->assertSession()->pageTextContains("Hello World!"); diff --git a/tests/src/Functional/EmitNodeEventTest.php b/tests/src/Functional/EmitNodeEventTest.php index 83f062ae7..3ebcc6ddd 100644 --- a/tests/src/Functional/EmitNodeEventTest.php +++ b/tests/src/Functional/EmitNodeEventTest.php @@ -44,7 +44,7 @@ public function testEmitEvent() { $this->addCondition('test', 'content_entity_type'); $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()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', $action_id); $this->assertSession()->statusCodeEquals(200); diff --git a/tests/src/Functional/EntityBundleTest.php b/tests/src/Functional/EntityBundleTest.php index bde1ee40e..27183826f 100644 --- a/tests/src/Functional/EntityBundleTest.php +++ b/tests/src/Functional/EntityBundleTest.php @@ -27,7 +27,7 @@ public function testEntityBundleType() { $this->addCondition('test', 'islandora_entity_bundle'); $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()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', 'hello_world'); // Create a new test_type confirm Hello World! is printed to the screen. diff --git a/tests/src/Functional/FormDisplayAlterReactionTest.php b/tests/src/Functional/FormDisplayAlterReactionTest.php index d394b7288..fe70aa645 100644 --- a/tests/src/Functional/FormDisplayAlterReactionTest.php +++ b/tests/src/Functional/FormDisplayAlterReactionTest.php @@ -49,7 +49,7 @@ public function testViewModeAlter() { $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()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); drupal_flush_all_caches(); diff --git a/tests/src/Functional/IndexingTest.php b/tests/src/Functional/IndexingTest.php index ff2152817..cf2dbb667 100644 --- a/tests/src/Functional/IndexingTest.php +++ b/tests/src/Functional/IndexingTest.php @@ -66,7 +66,7 @@ public function testIndexing() { $this->drupalGet("$url/delete"); // Delete the node. - $this->submitForm([], $this->t('Delete')); + $this->submitForm([], 'Delete'); $this->assertSession()->statusCodeEquals(200); // Confirm Goodbye, Cruel World! is printed to the screen. diff --git a/tests/src/Functional/IslandoraSettingsFormTest.php b/tests/src/Functional/IslandoraSettingsFormTest.php index 80a327af1..18bfcafb4 100644 --- a/tests/src/Functional/IslandoraSettingsFormTest.php +++ b/tests/src/Functional/IslandoraSettingsFormTest.php @@ -38,23 +38,23 @@ public function testJwtExpiry() { $this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour'); $this->drupalGet('/admin/config/islandora/core'); // 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->drupalGet('/admin/config/islandora/core'); // 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->drupalGet('/admin/config/islandora/core'); // 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->drupalGet('/admin/config/islandora/core'); // 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->drupalGet('/admin/config/islandora/core'); // 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.'); } diff --git a/tests/src/Functional/JsonldSelfReferenceReactionTest.php b/tests/src/Functional/JsonldSelfReferenceReactionTest.php index 1b4e24ec7..c8acfcc96 100644 --- a/tests/src/Functional/JsonldSelfReferenceReactionTest.php +++ b/tests/src/Functional/JsonldSelfReferenceReactionTest.php @@ -60,7 +60,7 @@ public function testMappingReaction() { $this->postNodeAddForm('test_type', ['title[0][value]' => 'Test Node'], - $this->t('Save')); + 'Save'); $this->assertSession()->pageTextContains("Test Node"); $url = $this->getUrl(); diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 75ae41dd3..5ab9037cb 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -32,7 +32,7 @@ public function testMappingReaction() { 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', ], 'Save and continue'); - $this->submitForm([], $this->t('Save field settings')); + $this->submitForm([], 'Save field settings'); } else { $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); @@ -46,7 +46,7 @@ public function testMappingReaction() { 'new_storage_type' => 'plain_text', 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', - ], $this->t('Continue')); + ], 'Continue'); // Now we can proceed, selecting the plain text (i.e. string) // for the second element now that the element is displayed after @@ -57,16 +57,16 @@ public function testMappingReaction() { 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', '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'); // Add the test node. $this->postNodeAddForm('test_type', [ 'title[0][value]' => 'Test Node', 'field_type_predicate[0][value]' => 'schema:Organization', - ], $this->t('Save')); + ], 'Save'); $this->assertSession()->pageTextContains("Test Node"); $url = $this->getUrl(); @@ -103,7 +103,7 @@ public function testMappingReaction() { $this->addCondition('test', 'islandora_entity_bundle'); $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()->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. // Subsequent changes to the context don't need a cache rebuild, though. From 89261c17aefa7c2b6110de57c4f0814e0c572cfc Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:06:22 -0400 Subject: [PATCH 3/9] Add some forgotten translateable markup. --- tests/src/Functional/ContentEntityTypeTest.php | 2 +- tests/src/Functional/DerivativeReactionTest.php | 4 ++-- tests/src/Functional/EmitNodeEventTest.php | 4 ++-- tests/src/Functional/IslandoraFunctionalTestBase.php | 2 +- tests/src/Functional/ViewModeAlterReactionTest.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/src/Functional/ContentEntityTypeTest.php b/tests/src/Functional/ContentEntityTypeTest.php index b753852ac..2fa9b5746 100644 --- a/tests/src/Functional/ContentEntityTypeTest.php +++ b/tests/src/Functional/ContentEntityTypeTest.php @@ -53,7 +53,7 @@ public function testContentEntityType() { 'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt', ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $this->assertSession()->pageTextNotContains("Hello World!"); } diff --git a/tests/src/Functional/DerivativeReactionTest.php b/tests/src/Functional/DerivativeReactionTest.php index 7c0cedb35..720b8a45b 100644 --- a/tests/src/Functional/DerivativeReactionTest.php +++ b/tests/src/Functional/DerivativeReactionTest.php @@ -71,9 +71,9 @@ public function testExecuteDerivativeReaction() { 'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file2.txt', ]; $this->drupalGet($media_url . '/edit'); - $this->getSession()->getPage()->pressButton($this->t('Remove')); + $this->getSession()->getPage()->pressButton('Remove'); $this->getSession()->getPage()->fillField('files[field_media_file_0]', __DIR__ . '/../../fixtures/test_file2.txt'); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->pageTextContains("Hello World!"); } diff --git a/tests/src/Functional/EmitNodeEventTest.php b/tests/src/Functional/EmitNodeEventTest.php index 3ebcc6ddd..a18ffbc8f 100644 --- a/tests/src/Functional/EmitNodeEventTest.php +++ b/tests/src/Functional/EmitNodeEventTest.php @@ -68,7 +68,7 @@ public function testEmitEvent() { protected function createEmitAction($entity_type, $event_type) { $this->drupalGet('admin/config/system/actions'); $this->getSession()->getPage()->findById("edit-action")->selectOption("Emit a $entity_type event to a queue/topic"); - $this->getSession()->getPage()->pressButton($this->t('Create')); + $this->getSession()->getPage()->pressButton('Create'); $this->assertSession()->statusCodeEquals(200); $action_id = "emit_" . $entity_type . "_" . lcfirst($event_type); @@ -76,7 +76,7 @@ protected function createEmitAction($entity_type, $event_type) { $this->getSession()->getPage()->fillField('edit-id', $action_id); $this->getSession()->getPage()->fillField('edit-queue', "emit-$entity_type-" . lcfirst($event_type)); $this->getSession()->getPage()->findById("edit-event")->selectOption($event_type); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); return $action_id; diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php index 016788d05..b4c0bc959 100644 --- a/tests/src/Functional/IslandoraFunctionalTestBase.php +++ b/tests/src/Functional/IslandoraFunctionalTestBase.php @@ -306,7 +306,7 @@ protected function addPresetReaction($context_id, $reaction_type, $action_id) { ->getPage() ->findById("edit-reactions-$reaction_type-actions") ->selectOption($action_id); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); } diff --git a/tests/src/Functional/ViewModeAlterReactionTest.php b/tests/src/Functional/ViewModeAlterReactionTest.php index 19660bda1..904414027 100644 --- a/tests/src/Functional/ViewModeAlterReactionTest.php +++ b/tests/src/Functional/ViewModeAlterReactionTest.php @@ -75,7 +75,7 @@ public function testViewModeAlter() { $this->drupalGet("admin/structure/context/test/reaction/add/view_mode_alter"); $this->getSession()->getPage()->findById("edit-reactions-view-mode-alter-mode")->selectOption('node.teaser'); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); drupal_flush_all_caches(); From 9f2277fc51c5e29bea3730e2bef3a0432f20b800 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:22:03 -0400 Subject: [PATCH 4/9] Exclude PHP 8.3 with Drupal 10.1. --- .github/workflows/build-2.x.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 4750ba4de..c5d9d66b0 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -29,6 +29,9 @@ jobs: drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] mysql: ["8.0"] allowed_failure: [false] + exclude: + - php-versions: "8.3" + drupal-version: "10.1.x" name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }} | test-suite ${{ matrix.test-suite }} From 13bc15ea43659824f2397a43914efe462a8dd546 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 16:50:50 -0400 Subject: [PATCH 5/9] Last attempt to not pass translatables as button labels. --- tests/src/Functional/IslandoraFunctionalTestBase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php index b4c0bc959..1ad8081d1 100644 --- a/tests/src/Functional/IslandoraFunctionalTestBase.php +++ b/tests/src/Functional/IslandoraFunctionalTestBase.php @@ -315,7 +315,7 @@ protected function addPresetReaction($context_id, $reaction_type, $action_id) { */ protected function postNodeAddForm($bundle_id, $values, $button_text) { $this->drupalGet("node/add/$bundle_id"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } @@ -324,7 +324,7 @@ protected function postNodeAddForm($bundle_id, $values, $button_text) { */ protected function postTermAddForm($taxomony_id, $values, $button_text) { $this->drupalGet("admin/structure/taxonomy/manage/$taxomony_id/add"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } @@ -333,7 +333,7 @@ protected function postTermAddForm($taxomony_id, $values, $button_text) { */ protected function postEntityEditForm($entity_url, $values, $button_text) { $this->drupalGet("$entity_url/edit"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } From a2c31fcaad87d753ca6725fef47fde39579c3342 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Wed, 3 Apr 2024 14:47:01 -0300 Subject: [PATCH 6/9] @adam-vessey's fix for drupalGet headers. --- tests/src/Functional/LinkHeaderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/Functional/LinkHeaderTest.php b/tests/src/Functional/LinkHeaderTest.php index 98b36c68b..78dd6c994 100644 --- a/tests/src/Functional/LinkHeaderTest.php +++ b/tests/src/Functional/LinkHeaderTest.php @@ -142,7 +142,7 @@ public function testMediaLinkHeaders() { $media_url = $this->media->toUrl('canonical', ['absolute' => TRUE])->toString(); // Perform a GET request as anonymous. - $this->drupalGet($media_url, [], ['Cache-Control: no-cache']); + $this->drupalGet($media_url, [], ['Cache-Control' => 'no-cache']); // Check link headers. $this->assertTrue( $this->validateLinkHeaderWithUrl('describes', $file_url, '', 'text/plain') == 1, @@ -174,7 +174,7 @@ public function testMediaLinkHeaders() { $this->drupalLogin($account); // Perform a GET request with update media permissions. - $this->drupalGet($media_url, [], ['Cache-Control: no-cache']); + $this->drupalGet($media_url, [], ['Cache-Control' => 'no-cache']); // Check link headers again, the edit-media link header should be present. $this->assertTrue( From cde2c133e1b06f90f5f9cce949e32d4ab0bffb2a Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 09:56:45 -0300 Subject: [PATCH 7/9] Update tests for D10.3's new field selector form. --- .../JsonldTypeAlterReactionTest.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 5ab9037cb..900360483 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -34,11 +34,11 @@ public function testMappingReaction() { ], 'Save and continue'); $this->submitForm([], 'Save field settings'); } - else { + elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt'){ $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); - // First need to submit the form with the elements displayed - // on initial page load. The form is using AJAX to send a second element - // after we selected the radio button above + // For Drupal 10.2, we first need to submit the form with the elements + // displayed on initial page load. The form is using AJAX to send a + // second element after we selected the radio button above // we can instead get the second element by submitting the form // and having it throw an error since the required field is missing. // @todo refactor this as a functional javascript test. @@ -59,6 +59,25 @@ public function testMappingReaction() { 'group_field_options_wrapper' => 'string', ], 'Continue'); } + else { + $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); + // For Drupal 10.3 the label is not visible at first. + // @todo refactor this as a functional javascript test. + $this->submitForm([ + 'new_storage_type' => 'plain_text', + ], 'Continue'); + + // Now we can proceed, entering a label and selecting Text (plain) + // for the second element now that the elements are displayed after + // the initial form submission. + $this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string'); + $this->submitForm([ + 'new_storage_type' => 'plain_text', + 'label' => 'Typed Predicate', + 'field_name' => 'type_predicate', + 'group_field_options_wrapper' => 'string', + ], 'Continue'); + } $this->submitForm([], 'Save settings'); $this->assertSession()->responseContains('field_type_predicate'); From 95c2d6c0c9970f48f44b579d19f76a3f87ed8767 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 10:04:05 -0300 Subject: [PATCH 8/9] Syntax. --- tests/src/Functional/JsonldTypeAlterReactionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 900360483..edefd77aa 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -34,7 +34,7 @@ public function testMappingReaction() { ], 'Save and continue'); $this->submitForm([], 'Save field settings'); } - elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt'){ + elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt')) { $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); // For Drupal 10.2, we first need to submit the form with the elements // displayed on initial page load. The form is using AJAX to send a From 263666f5fcf305e0fe8ee86fda03959e4db4bde7 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 14:51:20 -0300 Subject: [PATCH 9/9] Remove new_storage_type from form part 2. --- tests/src/Functional/JsonldTypeAlterReactionTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index edefd77aa..6ac70d7da 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -72,7 +72,6 @@ public function testMappingReaction() { // the initial form submission. $this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string'); $this->submitForm([ - 'new_storage_type' => 'plain_text', 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', 'group_field_options_wrapper' => 'string',