protected function setUp() { parent::setUp(); $this->HelperData = $this->getMock("Mollie_Mpm_Helper_Data", array("getCurrentStore")); $this->HelperData->expects($this->any())->method("getCurrentStore")->will($this->returnValue(self::STORE_ID)); $this->mage->expects($this->any())->method("Helper")->with("mpm")->will($this->returnValue($this->HelperData)); $this->resource = $this->getMock("stdClass", array("getConnection", "getTableName")); $this->mage->expects($this->any())->method("getSingleton")->will($this->returnValueMap(array(array("core/resource", $this->resource)))); $this->readconn = $this->getMock("stdClass", array("fetchAll", "quote")); $this->writeconn = $this->getMock("stdClass", array("fetchAll", "quote")); $this->resource->expects($this->any())->method("getConnection")->will($this->returnValueMap(array(array("core_read", $this->readconn), array("core_write", $this->writeconn)))); /* * Stubs that are fake quote-ers, does not really escape but just quote. */ $this->readconn->expects($this->any())->method("quote")->will($this->returnCallback(function ($arg) { return "'{$arg}'"; })); $this->writeconn->expects($this->any())->method("quote")->will($this->returnCallback(function ($arg) { return "'{$arg}'"; })); $this->resource->expects($this->any())->method("getTableName")->will($this->returnArgument(0)); }
public function testIsNotAvailableIfDisabledInAdmin() { $this->datahelper->expects($this->once())->method("getConfig")->with("mollie", "active")->will($this->returnValue(FALSE)); $model = new Mollie_Mpm_Model_Api(); $this->assertFalse($model->isAvailable()); }