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

Commit bb43155

Browse files
committed
Merge pull request #45 from webimpress/exception-interface
ExceptionInterface extends ExceptionInterface from zend-expressive-template
2 parents 1d15b9f + c44d4a1 commit bb43155

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

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)