Error in Merge Request Pipeline phpunit

Created on 3 September 2024, 4 months ago

Problem/Motivation

When adding a Merge Request the Pipeline throws this error in the test phase:

1) Drupal\Tests\content_moderation_notifications\Functional\Form\CrudFormTest::testNoWorkflows
TypeError: Behat\Mink\Element\TraversableElement::findButton(): Argument #1 ($locator) must be of type string, Drupal\Core\StringTranslation\TranslatableMarkup given, called in /builds/issue/content_moderation_notifications-3470888/web/core/tests/Drupal/Tests/WebAssert.php on line 177

This is caused by the testNoWorkflows tests last line:

public function testNoWorkflows() {
    // Remove the workflow.
    $workflow = Workflow::load('editorial');
    $workflow->delete();

    $this->drupalLogin($this->adminUser);
    $this->drupalGet('/admin/config/workflow/notifications');
    $this->clickLink(t('Add notification'));

    $this->assertSession()->pageTextContains(t('No workflows available.'));
    $this->assertSession()->linkExists(t('Manage workflows'));
    $this->assertSession()->buttonNotExists(t('Create Notification'));
  }

Steps to reproduce

Run the above mentioned test.

Proposed resolution

As quick fix convert to string like this:

$this->assertSession()->buttonNotExists((string)t('Create Notification'));
๐Ÿ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ญSwitzerland nadja_stu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024