Fixed tests without assertions

This commit is contained in:
Ingo Schommer 2012-11-23 15:52:00 +01:00
parent 26bdee4f08
commit 76b99e4006
2 changed files with 21 additions and 17 deletions

View File

@ -72,25 +72,26 @@ class CMSMainTest extends FunctionalTest {
* Test publication of one of every page type * Test publication of one of every page type
*/ */
public function testPublishOneOfEachKindOfPage() { public function testPublishOneOfEachKindOfPage() {
return; $this->markTestIncomplete();
$classes = ClassInfo::subclassesFor("SiteTree");
array_shift($classes); // $classes = ClassInfo::subclassesFor("SiteTree");
// array_shift($classes);
foreach($classes as $class) { // foreach($classes as $class) {
$page = new $class(); // $page = new $class();
if($class instanceof TestOnly) continue; // if($class instanceof TestOnly) continue;
$page->Title = "Test $class page"; // $page->Title = "Test $class page";
$page->write(); // $page->write();
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value()); // $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
$page->doPublish(); // $page->doPublish();
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value()); // $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
// Check that you can visit the page // // Check that you can visit the page
$this->get($page->URLSegment); // $this->get($page->URLSegment);
} // }
} }
/** /**

View File

@ -423,11 +423,14 @@ class SiteTreeTest extends SapphireTest {
* an error * an error
*/ */
public function testReadArchiveDate() { 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"); DataObject::get('SiteTree', "\"ParentID\" = 0");
Versioned::reading_archived_date(null); Versioned::reading_archived_date(null);
$this->assertEquals(
Versioned::get_reading_mode(),
'Archive.'
);
} }
public function testEditPermissions() { public function testEditPermissions() {