MINOR: versioning test for SiteTree

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101166 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-03-16 23:47:34 +00:00
parent 5ab421e946
commit 3dbf07f031

View File

@ -658,6 +658,33 @@ class SiteTreeTest extends SapphireTest {
$this->assertTrue($sitetree->validURLSegment(), 'Valid URLSegment values are allowed');
}
public function testVersionsAreCreated() {
$p = new Page();
$p->Content = "one";
$p->write();
$this->assertEquals(1, $p->Version);
// No changes don't bump version
$p->write();
$this->assertEquals(1, $p->Version);
$p->Content = "two";
$p->write();
$this->assertEquals(2, $p->Version);
// Only change meta-data don't bump version
$p->HasBrokenLink = true;
$p->write();
$p->HasBrokenLink = false;
$p->write();
$this->assertEquals(2, $p->Version);
$p->Content = "three";
$p->write();
$this->assertEquals(3, $p->Version);
}
}
/**#@+