Ejemplo n.º 1
0
 public function testCanAddAMixin()
 {
     // entry conditions
     MF_Obj_MixinsManager::destroy();
     // var_dump("Slate wiped clean; starting again");
     $this->fixture = new Test_ObjExt();
     $this->assertEquals('Test_ObjExt', get_class($this->fixture));
     $this->assertEquals(0, $this->fixture->mixinsCount);
     // change state
     __mf_extend('Test_ObjExt', 'Test_Obj_ExtMixin');
     $this->assertEquals(1, $this->fixture->mixinsCount);
     $this->assertEquals('Test_Obj_ExtMixin', $this->fixture->doSomethingInTheMixin());
     // we deliberately extend the base class of the fixture,
     // rather than the class of the fixture, as it is much
     // more of a torture test!
     __mf_extend('Test_ObjBase', 'Test_Obj_BaseMixin');
     // __mf_extend('Test_ObjExt', 'Test_Obj_BaseMixin');
     // retest
     $this->assertEquals(2, $this->fixture->mixinsCount);
     // $this->assertEquals($expectedMethods, $this->fixture->getMixinMethods());
     $this->assertEquals('Test_Obj_ExtMixin', $this->fixture->doSomethingInTheMixin());
     $this->assertEquals('Test_Obj_BaseMixin', $this->fixture->doSomethingInTheBaseMixin());
     // add in another mixin
     __mf_extend('Test_ObjExt', 'Test_Obj_ParentMixin');
     // retest
     $this->assertEquals(3, $this->fixture->mixinsCount);
     // now add in a mixin that's a child class of an existing
     // mixin that is in use
     __mf_extend('Test_ObjExt', 'Test_Obj_ChildMixin');
     // retest
     $this->assertEquals(4, $this->fixture->mixinsCount);
 }
Ejemplo n.º 2
0
 public function testCanResetListOfKnownMixins()
 {
     // entry conditions
     $this->assertEquals(0, MF_Obj_MixinsManager::$mixinAutoInc);
     __mf_extend('Test_ObjExt', 'Test_Obj_ExtMixin');
     $this->assertEquals(1, MF_Obj_MixinsManager::$mixinAutoInc);
     // make the changes
     MF_Obj_MixinsManager::destroy();
     // retest
     $this->assertEquals(0, MF_Obj_MixinsManager::$mixinAutoInc);
 }
Ejemplo n.º 3
0
 public function setup()
 {
     MF_Obj_MixinsManager::destroy();
     $this->fixture = new Test_ObjExt();
     __mf_extend('Test_ObjExt', 'Test_Obj_ExtMixin');
 }