diff --git a/src/PHPDraft/Model/Elements/Tests/ArrayStructureTest.php b/src/PHPDraft/Model/Elements/Tests/ArrayStructureTest.php index 54567d06..5d011ce8 100644 --- a/src/PHPDraft/Model/Elements/Tests/ArrayStructureTest.php +++ b/src/PHPDraft/Model/Elements/Tests/ArrayStructureTest.php @@ -17,7 +17,7 @@ class ArrayStructureTest extends TestBase public function setUp() { $this->class = new ArrayStructureElement(); - $this->reflection = new \ReflectionClass('PHPDraft\Model\DataStructureElement'); + $this->reflection = new \ReflectionClass('PHPDraft\Model\Elements\ArrayStructureElement'); } public function tearDown() @@ -26,56 +26,13 @@ public function tearDown() unset($this->reflection); } -// /** - // * Parse different objects - // * - // * @dataProvider parseObjectProvider - // * - // * @param string $object JSON Object - // * @param ArrayStructureElement $expected Expected Object output - // */ -// public function testSuccesfulParse($object, $expected) -// { -// $dep = []; -// $this->class->parse(json_decode($object), $dep); -// $this->assertSame($this->class->key, $expected->key); -// $this->assertSame($this->class->value, $expected->value); -// $this->assertSame($this->class->element, $expected->element); -// $this->assertSame($this->class->type, $expected->type); -// } - /** - * Provide objects to parse including expected outcome - * - * @return array + * Test if the value the class is initialized with is correct */ - public function parseObjectProvider() + public function testSetupCorrectly() { - $return = []; - $base1 = new ArrayStructureElement(); - $base1->key = 'Content-Type'; - $base1->value = 'application/json'; - $base1->element = 'member'; - $base1->type = 'Struct2'; - - $base2 = new ArrayStructureElement(); - $base2->key = 'Auth2'; - $base2->value = 'something'; - $base2->element = 'member'; - $base2->type = 'Struct1'; - -// $return[] = [ -// '{"element": "member", "meta": { "description": "Files to be added. Need to be downloaded from the server. Contains relative paths"}, -// "attributes": { "typeAttributes": ["required"]},"content": {"key": {"element": "string","content": "add"},"value": {"element": "array"}}}', -// $base1, -// ]; -// $return[] = [ -// '{"element":"member","meta":{"description":"A json array of categories associated with the item"},"attributes":{"typeAttributes":["required"]}, -// "content":{"key":{"element":"string","content":"categoryIds"},"value":{"element":"array","content":[{"element":"string", -// "content":"\"[\"111\",\"222\",\"333\"]\""}]}}}', -// $base2, -// ]; - - return $return; + $property = $this->reflection->getProperty('element'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php b/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php index 347f524f..99052009 100644 --- a/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php @@ -10,8 +10,29 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\Elements\RequestBodyElement; class RequestBodyElementTest extends TestBase { + public function setUp() + { + $this->class = new RequestBodyElement(); + $this->reflection = new \ReflectionClass('PHPDraft\Model\Elements\RequestBodyElement'); + } + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('element'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/CategoryTest.php b/src/PHPDraft/Model/Tests/CategoryTest.php index 002e62d1..6fadbb05 100644 --- a/src/PHPDraft/Model/Tests/CategoryTest.php +++ b/src/PHPDraft/Model/Tests/CategoryTest.php @@ -10,8 +10,36 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\Category; +use ReflectionClass; class CategoryTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $this->class = new Category(); + $this->reflection = new ReflectionClass('PHPDraft\Model\Category'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/HTTPRequestTest.php b/src/PHPDraft/Model/Tests/HTTPRequestTest.php index 673d873c..a7917bc4 100644 --- a/src/PHPDraft/Model/Tests/HTTPRequestTest.php +++ b/src/PHPDraft/Model/Tests/HTTPRequestTest.php @@ -10,8 +10,38 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\HTTPRequest; +use PHPDraft\Model\Transition; +use ReflectionClass; class HTTPRequestTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $parent = NULL; + $this->class = new HTTPRequest($parent); + $this->reflection = new ReflectionClass('PHPDraft\Model\HTTPRequest'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/HTTPResponseTest.php b/src/PHPDraft/Model/Tests/HTTPResponseTest.php index 681d976b..b2003025 100644 --- a/src/PHPDraft/Model/Tests/HTTPResponseTest.php +++ b/src/PHPDraft/Model/Tests/HTTPResponseTest.php @@ -10,8 +10,37 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\HTTPResponse; +use ReflectionClass; class HTTPResponseTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $parent = NULL; + $this->class = new HTTPResponse($parent); + $this->reflection = new ReflectionClass('PHPDraft\Model\HTTPResponse'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/HierarchyElementTest.php b/src/PHPDraft/Model/Tests/HierarchyElementTest.php index 4e1dd04b..b0a7369b 100644 --- a/src/PHPDraft/Model/Tests/HierarchyElementTest.php +++ b/src/PHPDraft/Model/Tests/HierarchyElementTest.php @@ -10,8 +10,35 @@ use PHPDraft\Core\TestBase; +use ReflectionClass; class HierarchyElementTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $this->class = $this->getMockForAbstractClass('PHPDraft\Model\HierarchyElement'); + $this->reflection = new ReflectionClass('PHPDraft\Model\HierarchyElement'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/ResourceTest.php b/src/PHPDraft/Model/Tests/ResourceTest.php index 2d39bb88..b960ce60 100644 --- a/src/PHPDraft/Model/Tests/ResourceTest.php +++ b/src/PHPDraft/Model/Tests/ResourceTest.php @@ -10,8 +10,37 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\Resource; +use ReflectionClass; class ResourceTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $parent = NULL; + $this->class = new Resource($parent); + $this->reflection = new ReflectionClass('PHPDraft\Model\Resource'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Model/Tests/TransitionTest.php b/src/PHPDraft/Model/Tests/TransitionTest.php index f9a59820..417f6d40 100644 --- a/src/PHPDraft/Model/Tests/TransitionTest.php +++ b/src/PHPDraft/Model/Tests/TransitionTest.php @@ -10,8 +10,37 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Model\Transition; +use ReflectionClass; class TransitionTest extends TestBase { + /** + * Set up + */ + public function setUp() + { + $parent = NULL; + $this->class = new Transition($parent); + $this->reflection = new ReflectionClass('PHPDraft\Model\Transition'); + } + /** + * Tear down + */ + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('parent'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Out/Tests/TemplateGeneratorTest.php b/src/PHPDraft/Out/Tests/TemplateGeneratorTest.php index 6d65bcf5..30015dfb 100644 --- a/src/PHPDraft/Out/Tests/TemplateGeneratorTest.php +++ b/src/PHPDraft/Out/Tests/TemplateGeneratorTest.php @@ -10,8 +10,32 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Out\TemplateGenerator; class TemplateGeneratorTest extends TestBase { + public function setUp() + { + $this->class = new TemplateGenerator('default', 'none'); + $this->reflection = new \ReflectionClass('PHPDraft\Out\TemplateGenerator'); + } + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('template'); + $property->setAccessible(TRUE); + $this->assertSame('default', $property->getValue($this->class)); + $property = $this->reflection->getProperty('image'); + $property->setAccessible(TRUE); + $this->assertSame('none', $property->getValue($this->class)); + } } \ No newline at end of file diff --git a/src/PHPDraft/Out/Tests/UITest.php b/src/PHPDraft/Out/Tests/UITest.php index 27da85da..75861763 100644 --- a/src/PHPDraft/Out/Tests/UITest.php +++ b/src/PHPDraft/Out/Tests/UITest.php @@ -2,7 +2,7 @@ /** * This file contains the UITest.php * - * @package php-drafter\SOMETHING + * @package php-drafter\Out * @author Sean Molenaar */ @@ -10,8 +10,30 @@ use PHPDraft\Core\TestBase; +use PHPDraft\Out\UI; +use ReflectionClass; class UITest extends TestBase { + public function setUp() + { + $this->class = new UI(); + $this->reflection = new ReflectionClass('PHPDraft\Out\UI'); + } + public function tearDown() + { + unset($this->class); + unset($this->reflection); + } + + /** + * Test if the value the class is initialized with is correct + */ + public function testSetupCorrectly() + { + $property = $this->reflection->getProperty('versionStringPrinted'); + $property->setAccessible(TRUE); + $this->assertNull($property->getValue($this->class)); + } } \ No newline at end of file