当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Config::expects方法代码示例

本文整理汇总了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));
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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();
 }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例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));
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:27,代码来源:LoggerTest.php

示例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);
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:19,代码来源:ZendTest.php


注:本文中的Mage_Core_Model_Config::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。