-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
smoench
committed
Aug 23, 2019
1 parent
7a1acb3
commit 6385bd7
Showing
15 changed files
with
187 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
parameters: | ||
level: 5 | ||
level: max | ||
paths: [src] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Configuration\Exception; | ||
|
||
final class FileCannotBeReadException extends \RuntimeException | ||
{ | ||
public static function fromFilename(string $filename): self | ||
{ | ||
return new self(sprintf( | ||
'File "%s" cannot be read.', | ||
$filename | ||
)); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Configuration/Exception/FileDoesNotExistsException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Configuration\Exception; | ||
|
||
final class FileDoesNotExistsException extends \RuntimeException | ||
{ | ||
public static function fromFilename(string $filename): self | ||
{ | ||
return new self(sprintf( | ||
'File "%s" does not exist. Run "deptrac init" to create one.', | ||
$filename | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Console/Command/Exception/SingleDepfileIsRequiredException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Console\Command\Exception; | ||
|
||
final class SingleDepfileIsRequiredException extends \RuntimeException | ||
{ | ||
public static function fromArgument($argument): self | ||
{ | ||
return new self(sprintf( | ||
'Please specify a path to a depfile. Got "%s".', | ||
gettype($argument) | ||
)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/Configuration/Exception/FileCannotBeReadExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SensioLabs\Deptrac\Configuration\Exception; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SensioLabs\Deptrac\Configuration\Exception\FileCannotBeReadException; | ||
|
||
/** | ||
* @covers \SensioLabs\Deptrac\Configuration\Exception\FileCannotBeReadException | ||
*/ | ||
final class FileCannotBeReadExceptionTest extends TestCase | ||
{ | ||
public function testIsRuntimeException(): void | ||
{ | ||
$exception = new FileCannotBeReadException(); | ||
|
||
self::assertInstanceOf(\RuntimeException::class, $exception); | ||
} | ||
|
||
public function testFromFilenameReturnsException(): void | ||
{ | ||
$filename = __FILE__; | ||
|
||
$exception = FileCannotBeReadException::fromFilename($filename); | ||
|
||
$message = sprintf( | ||
'File "%s" cannot be read.', | ||
$filename | ||
); | ||
|
||
self::assertSame($message, $exception->getMessage()); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/Configuration/Exception/FileDoesNotExistsExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SensioLabs\Deptrac\Configuration\Exception; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SensioLabs\Deptrac\Configuration\Exception\FileDoesNotExistsException; | ||
|
||
/** | ||
* @covers \SensioLabs\Deptrac\Configuration\Exception\FileDoesNotExistsException | ||
*/ | ||
final class FileDoesNotExistsExceptionTest extends TestCase | ||
{ | ||
public function testIsRuntimeException(): void | ||
{ | ||
$exception = new FileDoesNotExistsException(); | ||
|
||
self::assertInstanceOf(\RuntimeException::class, $exception); | ||
} | ||
|
||
public function testFromFilenameReturnsException(): void | ||
{ | ||
$filename = __FILE__; | ||
|
||
$exception = FileDoesNotExistsException::fromFilename($filename); | ||
|
||
$message = sprintf( | ||
'File "%s" does not exist. Run "deptrac init" to create one.', | ||
$filename | ||
); | ||
|
||
self::assertSame($message, $exception->getMessage()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/Console/Command/Exception/SingleDepfileIsRequiredExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SensioLabs\Deptrac\Console\Command\Exception; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SensioLabs\Deptrac\Console\Command\Exception\SingleDepfileIsRequiredException; | ||
|
||
/** | ||
* @covers \SensioLabs\Deptrac\Console\Command\Exception\SingleDepfileIsRequiredException | ||
*/ | ||
final class SingleDepfileIsRequiredExceptionTest extends TestCase | ||
{ | ||
public function testIsRuntimeException(): void | ||
{ | ||
$exception = new SingleDepfileIsRequiredException(); | ||
|
||
self::assertInstanceOf(\RuntimeException::class, $exception); | ||
} | ||
|
||
public function testFromFilenameReturnsException(): void | ||
{ | ||
$argument = []; | ||
|
||
$exception = SingleDepfileIsRequiredException::fromArgument($argument); | ||
|
||
$message = sprintf( | ||
'Please specify a path to a depfile. Got "%s".', | ||
gettype($argument) | ||
); | ||
|
||
self::assertSame($message, $exception->getMessage()); | ||
} | ||
} |