mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-25 17:21:19 +02:00
Fix expected exception test for PHP-7
This commit is contained in:
@@ -50,6 +50,21 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
|
|||||||
* @expectedException \PHPUnit_Framework_Error
|
* @expectedException \PHPUnit_Framework_Error
|
||||||
*/
|
*/
|
||||||
public function testDecoratorTypeHinted()
|
public function testDecoratorTypeHinted()
|
||||||
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '7', '>=')) {
|
||||||
|
throw new \PHPUnit_Framework_Error('Skip test for PHP 7', 0, __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array(new \stdClass()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Second key-point of this pattern : the decorator is type-hinted
|
||||||
|
*
|
||||||
|
* @requires PHP 7
|
||||||
|
* @expectedException TypeError
|
||||||
|
*/
|
||||||
|
public function testDecoratorTypeHintedForPhp7()
|
||||||
{
|
{
|
||||||
$this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array(new \stdClass()));
|
$this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array(new \stdClass()));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user