Ejemplo n.º 1
0
 public function register(ClassMocker $classMocker)
 {
     $classMocker->importFootprints(__DIR__ . '/mage.ref.json');
     $classMocker->registerTrait(Mage_Core_Helper_Abstract::class);
     $classMocker->registerTrait(Mage_Core_Model_Abstract::class);
     $classMocker->registerTrait(Mage_Core_Model_App::class);
     $classMocker->registerTrait(Varien_Object::class, 'Varien_Object', 100);
     $classMocker->registerTrait(Varien_Data_Collection::class, 'Varien_Data_Collection', 100);
     $classMocker->registerTrait(Varien_Data_Collection_Db::class);
     $classMocker->registerTrait(MageClass\ModelFactory::class);
     $classMocker->registerTrait(MageClass\Registry::class);
     $classMocker->registerBaseClass(MageFacade::class);
     $classMocker->mock('Mage');
     $classMocker->mock('MageClass');
     $classMocker->mock('Mage_*');
     $classMocker->mock('Varien_Object');
     $classMocker->mock('Varien_Data_Collection');
     $classMocker->mock('Varien_Data_Collection_Db');
     // optional mocking if no lib exists
     $classMocker->mock('Varien_', true);
 }
Ejemplo n.º 2
0
 /**
  * If register base class they must implement the BaseMock class
  *
  * @return void
  * @test
  * @see \JSiefer\ClassMocker\TestClasses\TestMock
  */
 public function testBaseClass()
 {
     $fwMocker = new ClassMocker();
     $fwMocker->mock('MyMock_*');
     $fwMocker->registerBaseClass(TestMock::class);
     $fwMocker->enable();
     $instance = new \MyMock_TestA();
     $this->assertInstanceOf(BaseMock::class, $instance, 'Instance does not extend from BaseMock');
     $this->assertInstanceOf(TestMock::class, $instance, 'Instance does not extend from registered base class');
     $fwMocker->disable();
 }