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
*/
public function testPublishOneOfEachKindOfPage() {
return;
$classes = ClassInfo::subclassesFor("SiteTree");
array_shift($classes);
$this->markTestIncomplete();
foreach($classes as $class) {
$page = new $class();
if($class instanceof TestOnly) continue;
// $classes = ClassInfo::subclassesFor("SiteTree");
// array_shift($classes);
$page->Title = "Test $class page";
// foreach($classes as $class) {
// $page = new $class();
// if($class instanceof TestOnly) continue;
$page->write();
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
// $page->Title = "Test $class page";
$page->doPublish();
$this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree_Live\" WHERE \"ID\" = $page->ID")->value());
// $page->write();
// $this->assertEquals("Test $class page", DB::query("SELECT \"Title\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value());
// Check that you can visit the page
$this->get($page->URLSegment);
}
// $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);
// }
}
/**

View File

@ -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() {