diff --git a/tests/unit/cms/classes/CmsCompoundObjectTest.php b/tests/unit/cms/classes/CmsCompoundObjectTest.php index 87a6d69b6..d5628d798 100644 --- a/tests/unit/cms/classes/CmsCompoundObjectTest.php +++ b/tests/unit/cms/classes/CmsCompoundObjectTest.php @@ -28,8 +28,7 @@ class CmsCompoundObjectTest extends TestCase { public function testLoadFile() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $obj = TestCmsCompoundObject::load($theme, 'compound.htm'); $this->assertContains("\$controller->data['something'] = 'some value'", $obj->code); @@ -53,8 +52,7 @@ class CmsCompoundObjectTest extends TestCase public function testParseComponentSettings() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $obj = TestCmsCompoundObject::load($theme, 'component.htm'); $this->assertArrayHasKey('components', $obj->settings); @@ -66,8 +64,7 @@ class CmsCompoundObjectTest extends TestCase public function testCache() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $themePath = $theme->getPath(); /* @@ -138,8 +135,7 @@ class CmsCompoundObjectTest extends TestCase public function testUndefinedProperty() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $obj = new TestCmsCompoundObject($theme); $this->assertNull($obj->something); @@ -147,8 +143,7 @@ class CmsCompoundObjectTest extends TestCase public function testSaveMarkup() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/compound-markup.htm'; if (file_exists($destFilePath)) @@ -172,8 +167,7 @@ class CmsCompoundObjectTest extends TestCase public function testSaveMarkupAndSettings() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/compound-markup-settings.htm'; if (file_exists($destFilePath)) @@ -198,8 +192,7 @@ class CmsCompoundObjectTest extends TestCase public function testSaveFull() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/compound.htm'; if (file_exists($destFilePath)) diff --git a/tests/unit/cms/classes/CmsExceptionTest.php b/tests/unit/cms/classes/CmsExceptionTest.php index 22074864d..31736bbdf 100644 --- a/tests/unit/cms/classes/CmsExceptionTest.php +++ b/tests/unit/cms/classes/CmsExceptionTest.php @@ -82,8 +82,7 @@ class CmsExceptionTest extends TestCase public function testCmsExceptionPhp() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $router = new Router($theme); $page = $router->findByUrl('/throw-php'); diff --git a/tests/unit/cms/classes/CmsObjectTest.php b/tests/unit/cms/classes/CmsObjectTest.php index a6fe497e4..f74193b16 100644 --- a/tests/unit/cms/classes/CmsObjectTest.php +++ b/tests/unit/cms/classes/CmsObjectTest.php @@ -23,8 +23,7 @@ class CmsObjectTest extends TestCase { public function testLoad() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $obj = TestCmsObject::load($theme, 'plain.html'); $this->assertEquals('
This is a test HTML content file.
', $obj->getContent()); @@ -37,8 +36,7 @@ class CmsObjectTest extends TestCase public function testLoadFromSubdirectory() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $obj = TestCmsObject::load($theme, 'subdir/obj.html'); $this->assertEquals('This is an object in a subdirectory.
', $obj->getContent()); @@ -51,24 +49,21 @@ class CmsObjectTest extends TestCase public function testValidateLoadInvalidTheme() { - $theme = new Theme(); - $theme->load('none'); + $theme = Theme::load('none'); $this->assertNull(TestCmsObject::load($theme, 'plain.html')); } public function testValidateLoadInvalidFile() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $this->assertNull(TestCmsObject::load($theme, 'none')); } public function testCache() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $themePath = $theme->getPath(); $filePath = $themePath .= '/temporary/test.htm'; @@ -131,8 +126,7 @@ class CmsObjectTest extends TestCase public function testFillFillable() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -151,8 +145,7 @@ class CmsObjectTest extends TestCase */ public function testFillNotFillable() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -168,8 +161,7 @@ class CmsObjectTest extends TestCase */ public function testFillInvalidFileNameSymbol() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -184,8 +176,7 @@ class CmsObjectTest extends TestCase */ public function testFillInvalidFileNamePath() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -201,8 +192,7 @@ class CmsObjectTest extends TestCase */ public function testFillInvalidFileSlash() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -217,8 +207,7 @@ class CmsObjectTest extends TestCase */ public function testFillEmptyFileName() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $testContents = 'mytestcontent'; $obj = new TestCmsObject($theme); @@ -229,8 +218,7 @@ class CmsObjectTest extends TestCase public function testSave() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/mytestobj.htm'; if (file_exists($destFilePath)) @@ -255,8 +243,7 @@ class CmsObjectTest extends TestCase */ public function testRename() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $srcFilePath = $theme->getPath().'/testobjects/mytestobj.htm'; $this->assertFileExists($srcFilePath); @@ -286,8 +273,7 @@ class CmsObjectTest extends TestCase */ public function testRenameToExistingFile() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $srcFilePath = $theme->getPath().'/testobjects/anotherobj.htm'; $this->assertFileExists($srcFilePath); @@ -307,8 +293,7 @@ class CmsObjectTest extends TestCase */ public function testSaveSameName() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $filePath = $theme->getPath().'/testobjects/anotherobj.htm'; $this->assertFileExists($filePath); @@ -328,8 +313,7 @@ class CmsObjectTest extends TestCase public function testSaveNewDir() { - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $destFilePath = $theme->getPath().'/testobjects/testsubdir/mytestobj.htm'; if (file_exists($destFilePath)) diff --git a/tests/unit/cms/classes/CodeParserTest.php b/tests/unit/cms/classes/CodeParserTest.php index 932e6088d..e87d79e1d 100644 --- a/tests/unit/cms/classes/CodeParserTest.php +++ b/tests/unit/cms/classes/CodeParserTest.php @@ -19,8 +19,7 @@ class CodeParserTest extends TestCase public function testParser() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $layout = Layout::load($theme, 'php-parser-test.htm'); $this->assertNotEmpty($layout); @@ -110,8 +109,7 @@ class CodeParserTest extends TestCase public function testParseNoPhp() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $layout = Layout::load($theme, 'no-php.htm'); $this->assertNotEmpty($layout); @@ -137,8 +135,7 @@ class CodeParserTest extends TestCase public function testParsePage() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $page = Page::load($theme, 'cycle-test.htm'); $this->assertNotEmpty($page); @@ -168,8 +165,7 @@ class CodeParserTest extends TestCase public function testOptionalPhpTags() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); /* * Test short PHP tags @@ -237,8 +233,7 @@ class CodeParserTest extends TestCase public function testNamespaces() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $page = Page::load($theme, 'code-namespaces.htm'); $this->assertNotEmpty($page); diff --git a/tests/unit/cms/classes/ComponentManagerTest.php b/tests/unit/cms/classes/ComponentManagerTest.php index e01814e1b..125181aa4 100644 --- a/tests/unit/cms/classes/ComponentManagerTest.php +++ b/tests/unit/cms/classes/ComponentManagerTest.php @@ -104,8 +104,7 @@ class ComponentManagerTest extends TestCase private function spoofPageCode() { // Spoof all the objects we need to make a page object - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $page = Page::load($theme, 'index.htm'); $layout = Layout::load($theme, 'content.htm'); $controller = new Controller($theme); diff --git a/tests/unit/cms/classes/ControllerTest.php b/tests/unit/cms/classes/ControllerTest.php index c199487ab..16237c22a 100644 --- a/tests/unit/cms/classes/ControllerTest.php +++ b/tests/unit/cms/classes/ControllerTest.php @@ -10,8 +10,7 @@ class ControllerTest extends TestCase /* * Test the built-in 404 page */ - $theme = new Theme(); - $theme->load('apitest'); + $theme = Theme::load('apitest'); $controller = new Controller($theme); $response = $controller->run('/some-page-that-doesnt-exist'); $this->assertNotEmpty($response); @@ -25,8 +24,7 @@ class ControllerTest extends TestCase /* * Test the theme 404 page */ - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $controller = new Controller($theme); $response = $controller->run('/some-page-that-doesnt-exist'); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); @@ -40,8 +38,7 @@ class ControllerTest extends TestCase /* * Test the / route and the fallback layout */ - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $controller = new Controller($theme); $response = $controller->run('/'); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); @@ -56,8 +53,7 @@ class ControllerTest extends TestCase */ public function testLayoutNotFound() { - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $controller = new Controller($theme); $response = $controller->run('/no-layout'); } @@ -67,8 +63,7 @@ class ControllerTest extends TestCase /* * Test existing layout */ - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $controller = new Controller($theme); $response = $controller->run('/with-layout'); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); @@ -81,8 +76,7 @@ class ControllerTest extends TestCase /* * Test partials referred in the layout and page */ - $theme = new Theme(); - $theme->load('test'); + $theme = Theme::load('test'); $controller = new Controller($theme); $response = $controller->run('/with-partials')->getContent(); $this->assertEquals('Hey PAGE PARTIAL Homer Simpson A partial
Hey PAGE CONTENT A content
Hey PAGE CONTENT