1234567891011121314151617181920212223242526272829 |
- <?php
- // this class actually creates pages and connects to a database. NO BUENO!
- class PageFactoryTest extends PHPUnit_Framework_TestCase
- {
- private $testObj;
- public function setUp()
- {
- $this->testObj = new PageFactory();
- }
- public function tearDown()
- {
- unset($_GET['id']);
- }
- public function testCreateReturns404ByDefault()
- {
- $actual = $this->testObj->create();
- $this->assertInstanceOf("Default404Page", $actual);
- }
- public function testCreateReturnsPageBasedOnId()
- {
- $_GET['id'] = 1;
- $actual = $this->testObj->create();
- $this->assertInstanceOf('TemplatePage', $actual);
- }
- }
|