BUGFIX: Removed some code that needed Extension to extend from Object.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84162 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-08-11 08:50:32 +00:00
parent 5790ddf708
commit 2b7572e21a
2 changed files with 9 additions and 9 deletions

View File

@ -183,7 +183,7 @@ class RequestHandler extends ViewableData {
// merge in any $allowed_actions from extensions // merge in any $allowed_actions from extensions
if($this->extension_instances) foreach($this->extension_instances as $extension) { if($this->extension_instances) foreach($this->extension_instances as $extension) {
if($extAccess = $extension->stat('allowed_actions')) { if($extAccess = Object::get_static($extension->class, 'allowed_actions')) {
$allowedActions = array_merge($allowedActions, $extAccess); $allowedActions = array_merge($allowedActions, $extAccess);
} }
} }

View File

@ -147,21 +147,21 @@ class ObjectTest extends SapphireTest {
*/ */
public function testUseCustomClass() { public function testUseCustomClass() {
$obj1 = Object::create('ObjectTest_CreateTest'); $obj1 = Object::create('ObjectTest_CreateTest');
$this->assertTrue($obj1->is_a('ObjectTest_CreateTest')); $this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2'); Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
$obj2 = Object::create('ObjectTest_CreateTest'); $obj2 = Object::create('ObjectTest_CreateTest');
$this->assertTrue($obj2->is_a('ObjectTest_CreateTest2')); $this->assertTrue($obj2 instanceof ObjectTest_CreateTest2);
$obj2_2 = Object::strong_create('ObjectTest_CreateTest'); $obj2_2 = Object::strong_create('ObjectTest_CreateTest');
$this->assertTrue($obj2_2->is_a('ObjectTest_CreateTest')); $this->assertTrue($obj2_2 instanceof ObjectTest_CreateTest);
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true); Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true);
$obj3 = Object::create('ObjectTest_CreateTest'); $obj3 = Object::create('ObjectTest_CreateTest');
$this->assertTrue($obj3->is_a('ObjectTest_CreateTest3')); $this->assertTrue($obj3 instanceof ObjectTest_CreateTest3);
$obj3_2 = Object::strong_create('ObjectTest_CreateTest'); $obj3_2 = Object::strong_create('ObjectTest_CreateTest');
$this->assertTrue($obj3_2->is_a('ObjectTest_CreateTest3')); $this->assertTrue($obj3_2 instanceof ObjectTest_CreateTest3);
} }
public function testGetExtensions() { public function testGetExtensions() {
@ -290,8 +290,8 @@ class ObjectTest extends SapphireTest {
} }
public function testIsA() { public function testIsA() {
$this->assertTrue(Object::create('ObjectTest_MyObject')->is_a('Object')); $this->assertTrue(Object::create('ObjectTest_MyObject') instanceof Object);
$this->assertTrue(Object::create('ObjectTest_MyObject')->is_a('ObjectTest_MyObject')); $this->assertTrue(Object::create('ObjectTest_MyObject') instanceof ObjectTest_MyObject);
} }
/** /**
@ -301,7 +301,7 @@ class ObjectTest extends SapphireTest {
$obj = new ObjectTest_ExtensionTest2(); $obj = new ObjectTest_ExtensionTest2();
$this->assertTrue($obj->hasExtension('ObjectTest_Extension')); $this->assertTrue($obj->hasExtension('ObjectTest_Extension'));
$this->assertTrue($obj->extInstance('ObjectTest_Extension')->is_a('ObjectTest_Extension')); $this->assertTrue($obj->extInstance('ObjectTest_Extension') instanceof ObjectTest_Extension);
} }
public function testCacheToFile() { public function testCacheToFile() {