本文整理汇总了PHP中Mage_Core_Controller_Request_Http::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::expects方法的具体用法?PHP Mage_Core_Controller_Request_Http::expects怎么用?PHP Mage_Core_Controller_Request_Http::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetFullActionName
public function testGetFullActionName()
{
$this->_request->expects($this->once())->method('getRequestedRouteName')->will($this->returnValue('adminhtml'));
$this->_request->expects($this->once())->method('getRequestedControllerName')->will($this->returnValue('index'));
$this->_request->expects($this->once())->method('getRequestedActionName')->will($this->returnValue('index'));
$this->assertEquals('adminhtml_index_index', $this->_actionAbstract->getFullActionName());
}
示例2: setUp
protected function setUp()
{
$this->_layout = $this->getMockBuilder('Mage_Core_Model_Layout')->disableOriginalConstructor()->setMethods(array('helper', 'getChildBlock', 'getChildName'))->getMock();
$this->_request = $this->getMockBuilder('Mage_Core_Controller_Request_Http')->disableOriginalConstructor()->setMethods(array('getParam'))->getMock();
$this->_request->expects($this->any())->method('getParam')->with('user_id')->will($this->returnValue(1));
$helper = new Magento_Test_Helper_ObjectManager($this);
$this->_block = $helper->getBlock('Mage_Webapi_Block_Adminhtml_User_Edit', array('urlBuilder' => $this->getMockBuilder('Mage_Backend_Model_Url')->disableOriginalConstructor()->getMock(), 'layout' => $this->_layout, 'request' => $this->_request));
}
示例3: testUpdate
/**
* @dataProvider updateDataProvider
* @param int $roleId
* @param array $filters
* @param bool $isAjax
* @param mixed $param
*/
public function testUpdate($roleId, $filters, $isAjax, $param)
{
$this->_request->expects($this->any())->method('getParam')->will($this->returnValueMap(array(array('role_id', null, $roleId), array('filter', '', $filters))));
$this->_request->expects($this->any())->method('isAjax')->will($this->returnValue($isAjax));
if ($param) {
$this->_collection->expects($this->once())->method('addFieldToFilter')->with('role_id', $param);
} else {
$this->_collection->expects($this->never())->method('addFieldToFilter');
}
/** @var Mage_Webapi_Model_Acl_Role_UsersUpdater $model */
$model = $this->_helper->getModel('Mage_Webapi_Model_Acl_Role_UsersUpdater', array('request' => $this->_request, 'backendHelper' => $this->_backendHelper));
$this->assertEquals($this->_collection, $model->update($this->_collection));
}
示例4: testBeforeToHtml
/**
* Test for _beforeToHtml method
*
* @dataProvider beforeToHtmlDataProvider
* @param object $apiRole
* @param array $expectedTabIds
*/
public function testBeforeToHtml($apiRole, $expectedTabIds)
{
$this->_block->setApiRole($apiRole);
$mainBlock = $this->_helper->getBlock('Mage_Core_Block_Text');
$resourceBlock = $this->_helper->getBlock('Mage_Core_Block_Text');
$userBlock = $this->_helper->getBlock('Mage_Core_Block_Text');
$this->_layout->expects($this->any())->method('getBlock')->will($this->returnValueMap(array(array('webapi.role.edit.tab.main', $mainBlock), array('webapi.role.edit.tab.resource', $resourceBlock), array('webapi.role.edit.tab.users.grid', $userBlock))));
$this->_request->expects($this->any())->method('getParam')->will($this->returnValueMap(array(array('active_tab', null, 'main_section'))));
// todo: do checks using toHtml() when DI is implemented for abstract blocks
$toHtmlMethod = new ReflectionMethod($this->_block, '_beforeToHtml');
$toHtmlMethod->setAccessible(true);
$toHtmlMethod->invoke($this->_block);
$this->assertEquals($expectedTabIds, $this->_block->getTabsIds());
$this->assertEquals($apiRole, $mainBlock->getApiRole());
$this->assertEquals($apiRole, $resourceBlock->getApiRole());
}