Test for hasMethod

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2.2@51454 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-03-19 04:27:06 +00:00
parent 5a05634c2d
commit e2ec5eeda1

23
tests/ObjectTest.php Executable file
View File

@ -0,0 +1,23 @@
<?php
class ObjectTest extends SapphireTest {
function testHasMethod() {
$st = new SiteTree();
$cc = new ContentController($st);
// Check that Versiond methods exist on SiteTree
$this->assertTrue($st->hasMethod('publish'), "Test SiteTree has publish");
$this->assertTrue($st->hasMethod('migrateVersion'), "Test SiteTree has migrateVersion");
// Check for different casing
$this->assertTrue($st->hasMethod('PuBliSh'), "Test SiteTree has PuBliSh");
$this->assertTrue($st->hasMethod('MiGratEVersIOn'), "Test SiteTree has MiGratEVersIOn");
// Check that SiteTree methods exist on ContentController (test failover)
$this->assertTrue($cc->hasMethod);
$this->assertTrue($cc->hasMethod('canView'), "Test ContentController has canView");
$this->assertTrue($cc->hasMethod('linkorcurrent'), "Test ContentController has linkorcurrent");
$this->assertTrue($cc->hasMethod('MiGratEVersIOn'), "Test ContentController has MiGratEVersIOn");
}
}