本文整理汇总了PHP中Mage_Core_Model_Config::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config::expects方法的具体用法?PHP Mage_Core_Model_Config::expects怎么用?PHP Mage_Core_Model_Config::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Config
的用法示例。
在下文中一共展示了Mage_Core_Model_Config::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Initialize reader instance
*/
protected function setUp()
{
$path = array(__DIR__, '..', '..', '_files', 'acl.xml');
$path = realpath(implode(DIRECTORY_SEPARATOR, $path));
$this->_configMock = $this->getMock('Mage_Core_Model_Config', array(), array(), '', false);
$this->_configMock->expects($this->any())->method('getModuleDir')->with('etc', 'Mage_Webapi')->will($this->returnValue(realpath(__DIR__ . '/../../../../../../../../../app/code/core/Mage/Webapi/etc')));
$this->_reader = new Mage_Webapi_Model_Authorization_Config_Reader($this->_configMock, array($path));
}
示例2: testGetWithWrongRendererClass
/**
* Test get method with wrong Renderer class.
*/
public function testGetWithWrongRendererClass()
{
$acceptTypes = array('application/json');
$availableRenders = $this->_createConfigElementForRenders();
/** Mock application config getNode method to return the list of renders. */
$this->_applicationMock->expects($this->once())->method('getNode')->will($this->returnValue($availableRenders));
/** Mock request getAcceptTypes method to return specified value. */
$this->_requestMock->expects($this->once())->method('getAcceptTypes')->will($this->returnValue($acceptTypes));
/** Mock object to return Varien_Object */
$this->_objectManagerMock->expects($this->once())->method('get')->with('Mage_Webapi_Controller_Response_Rest_Renderer_Json')->will($this->returnValue(new Varien_Object()));
$this->setExpectedException('LogicException', 'The renderer must implement "Mage_Webapi_Controller_Response_Rest_RendererInterface".');
$this->_factory->get();
}
示例3: testAddStreamLog
/**
* @param string $key
* @param string $fileOrWrapper
* @dataProvider addStreamLogDataProvider
*/
public function testAddStreamLog($key, $fileOrWrapper)
{
$this->_config->expects($this->any())->method('getNode')->will($this->returnValue(''));
$this->assertFalse($this->_model->hasLog($key));
$this->_model->addStreamLog($key, $fileOrWrapper);
$this->assertTrue($this->_model->hasLog($key));
$loggers = $this->_loggersProperty->getValue($this->_model);
$this->assertArrayHasKey($key, $loggers);
$zendLog = $loggers[$key];
$this->assertInstanceOf('Zend_Log', $zendLog);
$writersProperty = new ReflectionProperty($zendLog, '_writers');
$writersProperty->setAccessible(true);
$writers = $writersProperty->getValue($zendLog);
$this->assertArrayHasKey(0, $writers);
$stream = $writers[0];
$this->assertInstanceOf('Zend_Log_Writer_Stream', $writers[0]);
$streamProperty = new ReflectionProperty($stream, '_stream');
$streamProperty->setAccessible(true);
$fileOrWrapper = $streamProperty->getValue($stream);
$this->assertInternalType('resource', $fileOrWrapper);
$this->assertEquals('stream', get_resource_type($fileOrWrapper));
}
示例4: _prepareObjectManagerForGetCreateTests
/**
* Create Magento_ObjectManager_Zend instance
*
* @param bool $mockNewInstance
*/
protected function _prepareObjectManagerForGetCreateTests($mockNewInstance = false)
{
$this->_magentoConfig = $this->getMock('Mage_Core_Model_Config', array('loadBase'), array(), '', false);
$this->_magentoConfig->expects($this->any())->method('loadBase')->will($this->returnSelf());
$this->_instanceManager = $this->getMock('Zend\\Di\\InstanceManager', array('addSharedInstance'), array(), '', false);
$this->_diInstance = $this->getMock('Zend\\Di\\Di', array('instanceManager', 'newInstance', 'get', 'setDefinitionList'));
$this->_diInstance->expects($this->any())->method('instanceManager')->will($this->returnValue($this->_instanceManager));
if ($mockNewInstance) {
$this->_diInstance->expects($this->once())->method('newInstance')->will($this->returnCallback(array($this, 'verifyCreate')));
} else {
$this->_diInstance->expects($this->once())->method('get')->will($this->returnCallback(array($this, 'verifyGet')));
}
$this->_objectManager = new Magento_ObjectManager_Zend(null, $this->_diInstance);
}