This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ExceptionInterface as marker for package-specific exceptions
- Loading branch information
1 parent
ea9ea58
commit 5a05b4c
Showing
6 changed files
with
57 additions
and
3 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
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,15 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-stratigility for the canonical source repository | ||
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-stratigility/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace Zend\Stratigility\Exception; | ||
|
||
/** | ||
* Marker interface for package-specific exceptions. | ||
*/ | ||
interface ExceptionInterface | ||
{ | ||
} |
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,36 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-stratigility for the canonical source repository | ||
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-stratigility/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Stratigility\Exception; | ||
|
||
use Generator; | ||
use PHPUnit\Framework\TestCase; | ||
use Zend\Stratigility\Exception\ExceptionInterface; | ||
|
||
class ExceptionTest extends TestCase | ||
{ | ||
public function exception() : Generator | ||
{ | ||
$namespace = substr(ExceptionInterface::class, 0, strrpos(ExceptionInterface::class, '\\') + 1); | ||
|
||
$exceptions = glob(__DIR__ . '/../../src/Exception/*.php'); | ||
foreach ($exceptions as $exception) { | ||
$class = substr(basename($exception), 0, -4); | ||
|
||
yield $class => [$namespace . $class]; | ||
} | ||
} | ||
|
||
/** | ||
* @dataProvider exception | ||
*/ | ||
public function testExceptionIsInstanceOfExceptionInterface(string $exception) : void | ||
{ | ||
self::assertContains('Exception', $exception); | ||
self::assertTrue(is_a($exception, ExceptionInterface::class, true)); | ||
} | ||
} |