本文整理汇总了PHP中Mage_Core_Model_App::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::expects方法的具体用法?PHP Mage_Core_Model_App::expects怎么用?PHP Mage_Core_Model_App::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
/** Init all dependencies for SUT. */
$this->_storeMock = $this->getMockBuilder('Mage_Core_Model_Store')->disableOriginalConstructor()->getMock();
$this->_applicationMock = $this->getMockBuilder('Mage_Core_Model_App')->disableOriginalConstructor()->getMock();
$this->_applicationMock->expects($this->any())->method('getStore')->will($this->returnValue($this->_storeMock));
$this->_requestMock = $this->getMockBuilder('Mage_Webapi_Controller_Request_Soap')->disableOriginalConstructor()->getMock();
$this->_domDocumentFactory = $this->getMockBuilder('Magento_DomDocument_Factory')->disableOriginalConstructor()->getMock();
parent::setUp();
}
示例2: testMaskExceptionInDeveloperMode
/**
* Test maskException method with turned on developer mode.
*/
public function testMaskExceptionInDeveloperMode()
{
/** Mock app isDeveloperMode to return true. */
$this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true));
/** Init Logical exception. */
$logicalException = new LogicException();
/** Asser Webapi exception was not masked. */
$this->assertEquals($this->_errorProcessor->maskException($logicalException), $logicalException, 'Exception was masked wrong in developer mode.');
}
示例3: testSendResponseWithExceptionInDeveloperMode
/**
* Test sendResponse method with exception rendering.
*
* @dataProvider dataProviderForSendResponseWithExceptionInDeveloperMode
*/
public function testSendResponseWithExceptionInDeveloperMode($exception, $expectedResult, $assertMessage)
{
/** Mock all required objects. */
$this->_rendererMock->expects($this->any())->method('getMimeType')->will($this->returnValue('application/json'));
$this->_rendererMock->expects($this->any())->method('render')->will($this->returnCallback(array($this, 'callbackForSendResponseTest'), $this->returnArgument(0)));
$this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true));
$this->_responseRest->setException($exception);
/** Start output buffering. */
ob_start();
$this->_responseRest->sendResponse();
/** Clear output buffering. */
ob_end_clean();
$actualResponse = $this->_responseRest->getBody();
$this->assertStringStartsWith($expectedResult, $actualResponse, $assertMessage);
}
示例4: testUpdateDesignMode
public function testUpdateDesignMode()
{
$this->_setAdditionalExpectations();
$request = $this->getMock('Mage_Core_Controller_Request_Http', array('getParam'), array(), '', false);
$controller = $this->getMock('Mage_Adminhtml_Controller_Action', array('getFullActionName'), array(), '', false);
$request->expects($this->once())->method('getParam')->with('handle', '')->will($this->returnValue('default'));
$this->_backendSession->expects($this->once())->method('setData')->with('vde_current_mode', Mage_DesignEditor_Model_State::MODE_DESIGN);
$this->_backendSession->expects($this->once())->method('getData')->with('theme_id')->will($this->returnValue(self::THEME_ID));
$this->_urlModelFactory->expects($this->once())->method('replaceClassName')->with(self::URL_MODEL_DESIGN_MODE_CLASS_NAME);
$this->_layoutFactory->expects($this->once())->method('createLayout')->with(array('area' => self::AREA_CODE), self::LAYOUT_DESIGN_CLASS_NAME);
$this->_objectManager->expects($this->once())->method('addAlias')->with(self::LAYOUT_UPDATE_RESOURCE_MODEL_CORE_CLASS_NAME, self::LAYOUT_UPDATE_RESOURCE_MODEL_VDE_CLASS_NAME);
$this->_designPackage->expects($this->once())->method('getConfigPathByArea')->with(Mage_Core_Model_App_Area::AREA_FRONTEND)->will($this->returnValue(self::THEME_CONFIGURATION));
$store = $this->getMock('Mage_Core_Model_Store', array('setConfig'), array(), '', false);
$store->expects($this->once())->method('setConfig')->with(self::THEME_CONFIGURATION, self::THEME_ID);
$this->_application->expects($this->once())->method('getStore')->will($this->returnValue($store));
$this->_model->update(self::AREA_CODE, $request, $controller);
}