From 76b99e40065572f3c2cc2de2649f83f429368ef0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 23 Nov 2012 15:52:00 +0100 Subject: [PATCH] Fixed tests without assertions --- tests/controller/CMSMainTest.php | 29 +++++++++++++++-------------- tests/model/SiteTreeTest.php | 9 ++++++--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php index ade03182..b087841e 100644 --- a/tests/controller/CMSMainTest.php +++ b/tests/controller/CMSMainTest.php @@ -72,25 +72,26 @@ class CMSMainTest extends FunctionalTest { * Test publication of one of every page type */ public function testPublishOneOfEachKindOfPage() { - return; - $classes = ClassInfo::subclassesFor("SiteTree"); - array_shift($classes); + $this->markTestIncomplete(); + + // $classes = ClassInfo::subclassesFor("SiteTree"); + // array_shift($classes); - foreach($classes as $class) { - $page = new $class(); - if($class instanceof TestOnly) continue; + // foreach($classes as $class) { + // $page = new $class(); + // if($class instanceof TestOnly) continue; - $page->Title = "Test $class page"; + // $page->Title = "Test $class page"; - $page->write(); - $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value()); + // $page->write(); + // $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value()); - $page->doPublish(); - $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value()); + // $page->doPublish(); + // $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value()); - // Check that you can visit the page - $this->get($page->URLSegment); - } + // // Check that you can visit the page + // $this->get($page->URLSegment); + // } } /** diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index b556b781..f2d4b834 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -423,11 +423,14 @@ class SiteTreeTest extends SapphireTest { * an error */ public function testReadArchiveDate() { - Versioned::reading_archived_date('2009-07-02 14:05:07'); - + $date = '2009-07-02 14:05:07'; + Versioned::reading_archived_date($date); DataObject::get('SiteTree', "\"ParentID\" = 0"); - Versioned::reading_archived_date(null); + $this->assertEquals( + Versioned::get_reading_mode(), + 'Archive.' + ); } public function testEditPermissions() {