Skip to content

Commit cca4d11

Browse files
Merge pull request #123 from CollaboraOnline/fix-drupal-ci-test
Fix test in Drupal CI.
2 parents 7bd9764 + 87ce4bb commit cca4d11

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tests/src/FunctionalJavascript/CollaboraModalFormatterTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace Drupal\Tests\collabora_online\FunctionalJavascript;
1616

1717
use Behat\Mink\Element\NodeElement;
18+
use Drupal\Core\Url;
1819
use Drupal\field\Entity\FieldConfig;
1920
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
2021
use Drupal\media\MediaInterface;
@@ -81,7 +82,7 @@ public function testModalFormatterDisplay(): void {
8182
'access content',
8283
]);
8384
$this->drupalLogin($account);
84-
$expected_modal_url = '/cool/modal/' . $media->id();
85+
$expected_modal_url = Url::fromUserInput('/cool/modal/' . $media->id())->toString();
8586
$this->drupalGet($media->toUrl());
8687
$assert_session = $this->assertSession();
8788
$this->assertSame(
@@ -134,7 +135,10 @@ protected function assertPreviewButton(MediaInterface $media): NodeElement {
134135
$button = $this->assertSession()->elementExists('named', ['link', 'Preview']);
135136

136137
// Assert button attributes.
137-
$this->assertSame('/cool/modal/' . $media->id(), $button->getAttribute('href'));
138+
$this->assertSame(
139+
Url::fromUserInput('/cool/modal/' . $media->id())->toString(),
140+
$button->getAttribute('href'),
141+
);
138142

139143
return $button;
140144
}
@@ -151,7 +155,10 @@ protected function assertPreviewButton(MediaInterface $media): NodeElement {
151155
protected function assertModalWithIframe(MediaInterface $media): NodeElement {
152156
$assert_session = $this->assertSession();
153157
$iframe = $assert_session->waitForElementVisible('css', '.ui-dialog.cool-modal-preview > .ui-dialog-titlebar + .ui-dialog-content > iframe.cool-iframe');
154-
$this->assertSame('/cool/view/' . $media->id(), $iframe->getAttribute('src'));
158+
$this->assertSame(
159+
Url::fromUserInput('/cool/view/' . $media->id())->toString(),
160+
$iframe->getAttribute('src'),
161+
);
155162

156163
$this->assertStringContainsString(
157164
// The inline style is coming from the plugin settings.

0 commit comments

Comments
 (0)