* @copyright Meritoo * * @internal * @covers \Meritoo\Common\Exception\Regex\InvalidUrlException */ class InvalidUrlExceptionTest extends BaseTestCase { public function testConstructorVisibilityAndArguments() { static::assertConstructorVisibilityAndArguments(InvalidUrlException::class, OopVisibilityType::IS_PUBLIC, 3); } /** * @param string $url Invalid url * @param string $expectedMessage Expected exception's message * * @dataProvider provideUrl */ public function testConstructorMessage($url, $expectedMessage) { $exception = InvalidUrlException::create($url); static::assertSame($expectedMessage, $exception->getMessage()); } /** * Provides invalid url and expected exception's message * * @return Generator */ public function provideUrl() { $template = 'Url \'%s\' is invalid. Is there everything ok?'; yield[ 'aa/bb/cc', sprintf($template, 'aa/bb/cc'), ]; yield[ 'http:/images\show\car.jpg', sprintf($template, 'http:/images\show\car.jpg'), ]; } }