From fa48bc4895c2e0084196b9ea5bbe7fc64d4c9b9e Mon Sep 17 00:00:00 2001 From: Chi Date: Fri, 24 Apr 2020 06:57:59 +0000 Subject: [PATCH] Clean-up tests --- tests/src/Functional/TwigTweakTest.php | 8 ++++---- tests/src/Kernel/EntityFormViewBuilderTest.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/src/Functional/TwigTweakTest.php b/tests/src/Functional/TwigTweakTest.php index a23fe6e..264bdb4 100644 --- a/tests/src/Functional/TwigTweakTest.php +++ b/tests/src/Functional/TwigTweakTest.php @@ -258,14 +258,14 @@ final class TwigTweakTest extends BrowserTestBase { $url = Url::fromUserInput('/node/1/edit', ['absolute' => TRUE]); $link = Link::fromTextAndUrl('Edit', $url)->toString(); $xpath = '//div[@class = "tt-link"]'; - self::assertEquals($link, trim($this->xpath($xpath)[0]->getHtml())); + self::assertEquals($link, $this->xpath($xpath)[0]->getHtml()); // -- Link with HTML. $text = Markup::create('Edit'); $url = Url::fromUserInput('/node/1/edit', ['absolute' => TRUE]); $link = Link::fromTextAndUrl($text, $url)->toString(); $xpath = '//div[@class = "tt-link-html"]'; - self::assertEquals($link, trim($this->xpath($xpath)[0]->getHtml())); + self::assertEquals($link, $this->xpath($xpath)[0]->getHtml()); // -- Status messages. $xpath = '//div[@class = "tt-messages"]//div[contains(@class, "messages--status") and contains(., "Hello world!")]'; @@ -277,7 +277,7 @@ final class TwigTweakTest extends BrowserTestBase { // -- Protected link. $xpath = '//div[@class = "tt-link-access"]'; - self::assertEquals('', trim($this->xpath($xpath)[0]->getHtml())); + self::assertSame('', $this->xpath($xpath)[0]->getHtml()); // -- Token replacement. $xpath = '//div[@class = "tt-token-replace" and text() = "Site name: Drupal"]'; @@ -308,7 +308,7 @@ final class TwigTweakTest extends BrowserTestBase { // -- Text format. $xpath = '//div[@class = "tt-check-markup"]'; - self::assertEquals('bold strong', trim($this->xpath($xpath)[0]->getHtml())); + self::assertSame('bold strong', $this->xpath($xpath)[0]->getHtml()); // -- Format size. $xpath = '//div[@class = "tt-format-size"]'; diff --git a/tests/src/Kernel/EntityFormViewBuilderTest.php b/tests/src/Kernel/EntityFormViewBuilderTest.php index 1df47bb..c088867 100644 --- a/tests/src/Kernel/EntityFormViewBuilderTest.php +++ b/tests/src/Kernel/EntityFormViewBuilderTest.php @@ -80,7 +80,7 @@ final class EntityFormViewBuilderTest extends KernelTestBase { 'max-age' => 50, ]; self::assertSame($expected_cache, $build['#cache']); - self::assertContains('
renderPlain($build)); + self::assertStringContainsString('renderPlain($build)); // -- Private node with access check. $build = $view_builder->build($private_node); @@ -115,7 +115,7 @@ final class EntityFormViewBuilderTest extends KernelTestBase { 'max-age' => Cache::PERMANENT, ]; self::assertSame($expected_cache, $build['#cache']); - self::assertContains('renderPlain($build)); + self::assertStringContainsString('renderPlain($build)); } /**