Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 2df57aa

Browse files
committed
Merge branch 'feature/45-exception-interface' into release-2.0.0
Close #45
2 parents 1d15b9f + f02a9a8 commit 2df57aa

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ All notable changes to this project will be documented in this file, in reverse
2222
and void types. If you were extending classes from this package, you may need
2323
to update signatures of methods you override.
2424

25+
- [#45](https://github.com/zendframework/zend-expressive-zendviewrenderer/pull/45)
26+
updates the `ExceptionInterface` to extend from the `ExceptionInterface`
27+
provided in zend-expressive-template.
28+
2529
### Deprecated
2630

2731
- Nothing.

src/Exception/ExceptionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace Zend\Expressive\ZendView\Exception;
1111

12-
interface ExceptionInterface
12+
use Zend\Expressive\Template\Exception\ExceptionInterface as TemplateExceptionInterface;
13+
14+
interface ExceptionInterface extends TemplateExceptionInterface
1315
{
1416
}

test/ExceptionTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-expressive-zendviewrenderer for the canonical source repository
4+
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-expressive-zendviewrenderer/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace ZendTest\Expressive\ZendView;
11+
12+
use Generator;
13+
use PHPUnit\Framework\TestCase;
14+
use Zend\Expressive\Template\Exception\ExceptionInterface as TemplateExceptionInterface;
15+
use Zend\Expressive\ZendView\Exception\ExceptionInterface;
16+
17+
class ExceptionTest extends TestCase
18+
{
19+
public function testExceptionInterfaceExtendsTemplateExceptionInterface() : void
20+
{
21+
self::assertTrue(is_a(ExceptionInterface::class, TemplateExceptionInterface::class, true));
22+
}
23+
24+
public function exception() : Generator
25+
{
26+
$namespace = substr(ExceptionInterface::class, 0, strrpos(ExceptionInterface::class, '\\') + 1);
27+
28+
$exceptions = glob(__DIR__ . '/../src/Exception/*.php');
29+
foreach ($exceptions as $exception) {
30+
$class = substr(basename($exception), 0, -4);
31+
32+
yield $class => [$namespace . $class];
33+
}
34+
}
35+
36+
/**
37+
* @dataProvider exception
38+
*/
39+
public function testExceptionIsInstanceOfExceptionInterface(string $exception) : void
40+
{
41+
self::assertContains('Exception', $exception);
42+
self::assertTrue(is_a($exception, ExceptionInterface::class, true));
43+
}
44+
}

0 commit comments

Comments
 (0)