mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-03 13:37:27 +02:00
more test to show the key features of patterns
This commit is contained in:
@@ -27,9 +27,13 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertRegExp('#^\s{4}#m', $form->render());
|
$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()
|
public function testFormImplementsFormEelement()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->assertTrue(is_subclass_of('DesignPatterns\Composite\Form', 'DesignPatterns\Composite\FormElement'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -37,9 +37,27 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertXmlStringEqualsXmlString('<?xml version="1.0"?><foo>bar</foo>', $service->renderData());
|
$this->assertXmlStringEqualsXmlString('<?xml version="1.0"?><foo>bar</foo>', $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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user