1515namespace Drupal \Tests \collabora_online \FunctionalJavascript ;
1616
1717use Behat \Mink \Element \NodeElement ;
18+ use Drupal \Core \Url ;
1819use Drupal \field \Entity \FieldConfig ;
1920use Drupal \FunctionalJavascriptTests \WebDriverTestBase ;
2021use 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