* @copyright Meritoo */ class InvalidSizeDimensionsExceptionTest extends BaseTestCase { public function testConstructorVisibilityAndArguments() { static::assertConstructorVisibilityAndArguments( InvalidSizeDimensionsException::class, OopVisibilityType::IS_PUBLIC, 3 ); } /** * @param int $width The width * @param int $height The height * @param string $expectedMessage Expected exception's message * * @dataProvider provideWidthAndHeight */ public function testCreate($width, $height, $expectedMessage) { $exception = InvalidSizeDimensionsException::create($width, $height); static::assertSame($expectedMessage, $exception->getMessage()); } public function provideWidthAndHeight() { $template = 'Dimensions of size should be positive, but they are not: %d, %d. Is there everything ok?'; yield[ 0, 0, sprintf($template, 0, 0), ]; yield[ -1, -1, sprintf($template, -1, -1), ]; yield[ 200, 100, sprintf($template, 200, 100), ]; } }