dav-m85/magento-mock
最新稳定版本:v0.1.1
Composer 安装命令:
composer require dav-m85/magento-mock
包简介
README 文档
README
Magento mock
Hat trick to have Mage class mocked.
Installation
Setup autoloading
// Register Varien autoloader for Mage related stuff include_once "Varien/Autoload.php"; include_once "core/Mage/Core/functions.php"; spl_autoload_register(array(Varien_Autoload::instance(), 'autoload')); // Mock Mage instance include_once "Mage.php"; include_once "MageMockInterface.php";
Usage
class CustomerTest extends PHPUnit_Framework_TestCase { private $mage; public function setUp() { $this->mage = $this->prophesize("MageMockInterface"); Mage::setMageInstance($this->mage->reveal()); // Getting an helper ? $this->mage->helper('some-helper')->willReturn(...); // New Model ? $this->mage->getResourceSingleton("customer/customer", \Prophecy\Argument::cetera())->willReturn( $this->prophesize('Mage_Core_Model_Resource_Db_Abstract')->reveal() ); } public function testSomething() { ... }
统计信息
- 总下载量: 5.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-13