本文整理汇总了PHP中Mage_Core_Model_Layout::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Layout::expects方法的具体用法?PHP Mage_Core_Model_Layout::expects怎么用?PHP Mage_Core_Model_Layout::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Layout
的用法示例。
在下文中一共展示了Mage_Core_Model_Layout::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetHeaderText
/**
* Test getHeaderText method
*/
public function testGetHeaderText()
{
$apiUser = new Varien_Object();
$this->_block->setApiUser($apiUser);
$this->assertEquals('New API User', $this->_block->getHeaderText());
$apiUser->setId(1)->setApiKey('test-api');
/** @var PHPUnit_Framework_MockObject_MockObject $coreHelper */
$coreHelper = $this->getMockBuilder('Mage_Core_Helper_Data')->disableOriginalConstructor()->setMethods(array('escapeHtml'))->getMock();
$coreHelper->expects($this->once())->method('escapeHtml')->with($apiUser->getApiKey())->will($this->returnArgument(0));
$this->_layout->expects($this->once())->method('helper')->with('Mage_Core_Helper_Data')->will($this->returnValue($coreHelper));
$this->assertEquals("Edit API User 'test-api'", $this->_block->getHeaderText());
}
示例2: setUp
protected function setUp()
{
$this->_layoutMock = $this->getMock('Mage_Core_Model_Layout', array(), array(), '', false);
$this->_columnSetMock = $this->getMock('Mage_Backend_Block_Widget_Grid_ColumnSet', array(), $this->_prepareConstructorArguments());
$returnValueMap = array(array('grid', 'grid.columnSet', 'grid.columnSet'), array('grid', 'reset_filter_button', 'reset_filter_button'), array('grid', 'search_button', 'search_button'));
$this->_layoutMock->expects($this->any())->method('getChildName')->will($this->returnValueMap($returnValueMap));
$this->_layoutMock->expects($this->any())->method('getBlock')->with('grid.columnSet')->will($this->returnValue($this->_columnSetMock));
$this->_layoutMock->expects($this->any())->method('createBlock')->with('Mage_Backend_Block_Widget_Button')->will($this->returnValue(Mage::app()->getLayout()->createBlock('Mage_Backend_Block_Widget_Button')));
$this->_block = Mage::app()->getLayout()->createBlock('Mage_Backend_Block_Widget_Grid');
$this->_block->setLayout($this->_layoutMock);
$this->_block->setNameInLayout('grid');
}
示例3: 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());
}