diff --git a/src/Symfony/Component/Notifier/Test/TransportTestCase.php b/src/Symfony/Component/Notifier/Test/TransportTestCase.php index d81e8b79c05c6..012f4c56fa73d 100644 --- a/src/Symfony/Component/Notifier/Test/TransportTestCase.php +++ b/src/Symfony/Component/Notifier/Test/TransportTestCase.php @@ -96,7 +96,7 @@ public function testCanSetCustomHost() $transport->setHost($customHost = self::CUSTOM_HOST); - $this->assertStringContainsString(sprintf('://%s', $customHost), (string) $transport); + $this->assertMatchesRegularExpression(sprintf('/^.*\:\/\/(%s|.*\@%s)/', $customHost, $customHost), (string) $transport); } public function testCanSetCustomPort() @@ -106,9 +106,9 @@ public function testCanSetCustomPort() $transport->setPort($customPort = self::CUSTOM_PORT); /* - * @see https://regex101.com/r/0xQKuY/2 + * @see https://regex101.com/r/shT9O2/1 */ - $this->assertMatchesRegularExpression(sprintf('/^.*\/\/.*\:%s.*$/', $customPort), (string) $transport); + $this->assertMatchesRegularExpression(sprintf('/^.*\:\/\/.*(\@.*)?\:%s((\?.*|\/.*))?$/', $customPort), (string) $transport); } public function testCanSetCustomHostAndPort() @@ -118,6 +118,6 @@ public function testCanSetCustomHostAndPort() $transport->setHost($customHost = self::CUSTOM_HOST); $transport->setPort($customPort = self::CUSTOM_PORT); - $this->assertStringContainsString(sprintf('://%s:%s', $customHost, $customPort), (string) $transport); + $this->assertMatchesRegularExpression(sprintf('/^.*\:\/\/(%s|.*\@%s)\:%s/', $customHost, $customHost, $customPort), (string) $transport); } }