diff --git a/Tests/Composite/FormTest.php b/Tests/Composite/FormTest.php index 71a275c..a706c99 100644 --- a/Tests/Composite/FormTest.php +++ b/Tests/Composite/FormTest.php @@ -27,9 +27,13 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->assertRegExp('#^\s{4}#m', $form->render()); } + /** + * The all point of this pattern, a Composite must inherit from the node + * if you wanto to builld trees + */ public function testFormImplementsFormEelement() { - $this->markTestIncomplete(); + $this->assertTrue(is_subclass_of('DesignPatterns\Composite\Form', 'DesignPatterns\Composite\FormElement')); } } \ No newline at end of file diff --git a/Tests/Decorator/DecoratorTest.php b/Tests/Decorator/DecoratorTest.php index 4eee22b..35e19a7 100644 --- a/Tests/Decorator/DecoratorTest.php +++ b/Tests/Decorator/DecoratorTest.php @@ -37,9 +37,27 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase $this->assertXmlStringEqualsXmlString('bar', $service->renderData()); } - public function testDecoratorImplementsRenderer() + /** + * The first key-point of this pattern : + */ + public function testDecoratorMustImplementsRenderer() { - $this->markTestIncomplete(); + $this->assertTrue(is_subclass_of('DesignPatterns\Decorator\Decorator', 'DesignPatterns\Decorator\Renderer')); + } + + /** + * @expectedException \PHPUnit_Framework_Error + */ + public function testDecoratorTypeHinted() + { + $this->getMockForAbstractClass('DesignPatterns\Decorator\Decorator', array(new \stdClass())); + } + + public function testDecoratorOnlyAcceptRenderer() + { + $mock = $this->getMock('DesignPatterns\Decorator\Renderer'); + $dec = $this->getMockForAbstractClass('DesignPatterns\Decorator\Decorator', array($mock)); + $this->assertNotNull($dec); } } \ No newline at end of file