mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Exceptions > create instance of exception using static "create()" method (instead of constructor)
This commit is contained in:
@@ -23,7 +23,7 @@ class IncorrectColorHexLengthExceptionTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(IncorrectColorHexLengthException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(IncorrectColorHexLengthException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ class IncorrectColorHexLengthExceptionTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorMessage($color, $expectedMessage)
|
||||
{
|
||||
$exception = new IncorrectColorHexLengthException($color);
|
||||
$exception = IncorrectColorHexLengthException::create($color);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Meritoo\Common\Test\Exception\Regex;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
|
||||
@@ -22,12 +21,9 @@ use Meritoo\Common\Type\OopVisibilityType;
|
||||
*/
|
||||
class InvalidColorHexValueExceptionTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @throws UnknownOopVisibilityTypeException
|
||||
*/
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(InvalidColorHexValueException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(InvalidColorHexValueException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +34,7 @@ class InvalidColorHexValueExceptionTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorMessage($color, $expectedMessage)
|
||||
{
|
||||
$exception = new InvalidColorHexValueException($color);
|
||||
$exception = InvalidColorHexValueException::create($color);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Meritoo\Common\Test\Exception\Regex;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Regex\InvalidHtmlAttributesException;
|
||||
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
|
||||
@@ -22,12 +21,9 @@ use Meritoo\Common\Type\OopVisibilityType;
|
||||
*/
|
||||
class InvalidHtmlAttributesExceptionTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @throws UnknownOopVisibilityTypeException
|
||||
*/
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(InvalidHtmlAttributesException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(InvalidHtmlAttributesException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +34,7 @@ class InvalidHtmlAttributesExceptionTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorMessage($htmlAttributes, $expectedMessage)
|
||||
{
|
||||
$exception = new InvalidHtmlAttributesException($htmlAttributes);
|
||||
$exception = InvalidHtmlAttributesException::create($htmlAttributes);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class InvalidUrlExceptionTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(InvalidUrlException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(InvalidUrlException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ class InvalidUrlExceptionTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorMessage($url, $expectedMessage)
|
||||
{
|
||||
$exception = new InvalidUrlException($url);
|
||||
$exception = InvalidUrlException::create($url);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user