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 EmptyFileExceptionTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(EmptyFileException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(EmptyFileException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,9 +32,9 @@ class EmptyFileExceptionTest extends BaseTestCase
|
||||
*
|
||||
* @dataProvider providePathOfFile
|
||||
*/
|
||||
public function testConstructorMessage($emptyFilePath, $expectedMessage)
|
||||
public function testMessage($emptyFilePath, $expectedMessage)
|
||||
{
|
||||
$exception = new EmptyFileException($emptyFilePath);
|
||||
$exception = EmptyFileException::create($emptyFilePath);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ class EmptyFilePathExceptionTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(EmptyFilePathException::class, OopVisibilityType::IS_PUBLIC);
|
||||
static::assertConstructorVisibilityAndArguments(EmptyFilePathException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
public function testConstructorMessage()
|
||||
{
|
||||
$exception = new EmptyFilePathException();
|
||||
$exception = EmptyFilePathException::create();
|
||||
static::assertEquals('Path of the file is empty. Did you provide path of proper file?', $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class NotExistingFileExceptionTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(NotExistingFileException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(NotExistingFileException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ class NotExistingFileExceptionTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorMessage($notExistingFilePath, $expectedMessage)
|
||||
{
|
||||
$exception = new NotExistingFileException($notExistingFilePath);
|
||||
$exception = NotExistingFileException::create($notExistingFilePath);
|
||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user