PageFactoryTest.php 602 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. // this class actually creates pages and connects to a database. NO BUENO!
  3. class PageFactoryTest extends PHPUnit_Framework_TestCase
  4. {
  5. private $testObj;
  6. public function setUp()
  7. {
  8. $this->testObj = new PageFactory();
  9. }
  10. public function tearDown()
  11. {
  12. unset($_GET['id']);
  13. }
  14. public function testCreateReturns404ByDefault()
  15. {
  16. $actual = $this->testObj->create();
  17. $this->assertInstanceOf("Default404Page", $actual);
  18. }
  19. public function testCreateReturnsPageBasedOnId()
  20. {
  21. $_GET['id'] = 1;
  22. $actual = $this->testObj->create();
  23. $this->assertInstanceOf('TemplatePage', $actual);
  24. }
  25. }