本文整理汇总了PHP中EcomDev_Utils_Reflection::invokeRestrictedMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP EcomDev_Utils_Reflection::invokeRestrictedMethod方法的具体用法?PHP EcomDev_Utils_Reflection::invokeRestrictedMethod怎么用?PHP EcomDev_Utils_Reflection::invokeRestrictedMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EcomDev_Utils_Reflection
的用法示例。
在下文中一共展示了EcomDev_Utils_Reflection::invokeRestrictedMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetVersionScriptsDiff
/**
* Test version
*
* @param string[]|string $directories
* @param string $type
* @param string $from
* @param string $to
*
* @return void
* @dataProvider dataProvider
*/
public function testGetVersionScriptsDiff($directories, $type, $from, $to)
{
$virtualPath = $this->getVirtualPath($directories);
$versions = EcomDev_Utils_Reflection::invokeRestrictedMethod($this->constraint, 'parseVersions', array($virtualPath));
$result = EcomDev_Utils_Reflection::invokeRestrictedMethod($this->constraint, 'getVersionScriptsDiff', array($versions[$type], $from, $to, $type === 'data' ? 'data-' : ''));
$this->assertEquals($this->expected('auto')->getDiff(), $result);
}
示例2: testReturnsCorrectImageProcessorClass
public function testReturnsCorrectImageProcessorClass()
{
/** @var $image Varien_Image */
$image = $this->_model->getImageProcessor();
$adapterClass = EcomDev_Utils_Reflection::invokeRestrictedMethod($image, '_getAdapter');
$this->assertInstanceOf('Varien_Image_Adapter_Abstract', $adapterClass);
}
示例3: testGetItemColorAndSizeInfo
/**
* verify
* - the localized and default values are returned
* - if the option does not exist, null is returned
* for both default and localized values
*
* @param string $method
* @param string $localizedValue
* @param string $defaultValue
* @dataProvider provideForSizeColorInfo
*/
public function testGetItemColorAndSizeInfo($method, $localizedValue, $defaultValue)
{
$this->replaceByMock('resource_model', 'eav/entity_attribute_option_collection', $this->optionValueCollectionStub);
$this->optionValueCollectionStub->addItem(Mage::getModel('eav/entity_attribute_option', ['attribute_code' => 'color', 'option_id' => 15, 'value' => 'Black', 'default_value' => '2']));
$handler = Mage::getModel('ebayenterprise_order/create_orderitem');
$this->assertSame([$localizedValue, $defaultValue], EcomDev_Utils_Reflection::invokeRestrictedMethod($handler, $method, [$this->itemStub]));
}
示例4: testLogResultCodeWithError
/**
* will log a warning when the result code is
* for an error or is unknown
* @dataProvider provideFailureResultCodes
*/
public function testLogResultCodeWithError($code)
{
$response = $this->getModelMockBuilder('ebayenterprise_address/validation_response')->setConstructorArgs([['api' => $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi'), 'logger' => $this->logger, 'context' => $this->context]])->setMethods(['extractResponseData'])->getMock();
$response->setResultCode($code);
$this->logger->expects($this->once())->method('warning');
EcomDev_Utils_Reflection::invokeRestrictedMethod($response, 'logResultCode');
}
示例5: testSdkExceptionHandling
/**
* GIVEN An <sdkApi> that will thrown an <exception> of <exceptionType> when making a request.
* WHEN A request is made.
* THEN The <exception> will be caught.
* AND An exception of <expectedExceptionType> will be thrown.
*
* @param string
* @param string
* @dataProvider provideSdkExceptions
*/
public function testSdkExceptionHandling($exceptionType, $expectedExceptionType)
{
$exception = new $exceptionType(__METHOD__ . ': Test Exception');
$this->api->method('send')->will($this->throwException($exception));
$this->setExpectedException($expectedExceptionType);
EcomDev_Utils_Reflection::invokeRestrictedMethod($this->allocator, 'makeRequest', [$this->api]);
}
示例6: testGetGiftCardType
/**
* Test _getGiftCardType method for the following expectations
* Expectation 1: when this test invoked the method EbayEnterprise_Catalog_Helper_Map_Giftcard::_getGiftCardType
* with string of each giftcard constant type it will return the gift card constant value
*/
public function testGetGiftCardType()
{
$testData = array(array('expect' => Enterprise_GiftCard_Model_Giftcard::TYPE_VIRTUAL, 'type' => EbayEnterprise_Catalog_Helper_Map_Giftcard::GIFTCARD_VIRTUAL), array('expect' => Enterprise_GiftCard_Model_Giftcard::TYPE_PHYSICAL, 'type' => EbayEnterprise_Catalog_Helper_Map_Giftcard::GIFTCARD_PHYSICAL), array('expect' => Enterprise_GiftCard_Model_Giftcard::TYPE_COMBINED, 'type' => EbayEnterprise_Catalog_Helper_Map_Giftcard::GIFTCARD_COMBINED));
$giftcard = Mage::helper('ebayenterprise_catalog/map_giftcard');
foreach ($testData as $data) {
$this->assertSame($data['expect'], EcomDev_Utils_Reflection::invokeRestrictedMethod($giftcard, '_getGiftCardType', array($data['type'])));
}
}
示例7: testBeforeSave
/**
* Before an item is saved, if the item has an associated order address
* with a valid id, the id of the order address should be set on the item.
*/
public function testBeforeSave()
{
$addressId = 8;
$address = Mage::getModel('sales/order_address', ['entity_id' => $addressId]);
$this->_item->setOrderAddress($address);
EcomDev_Utils_Reflection::invokeRestrictedMethod($this->_item, '_beforeSave');
$this->assertSame($addressId, $this->_item->getOrderAddressId());
}
示例8: testFeedFields
/**
* Test getting the fields to include in the feed. Should be pulling the
* comma-separated list of fields from config.xml and splitting it to produce
* an array of fields.
* @return array
*/
public function testFeedFields()
{
$config = $this->getHelperMock('eems_affiliate/config', array('getItemizedOrderFeedFields'));
$config->expects($this->any())->method('getItemizedOrderFeedFields')->will($this->returnValue('one,two,three'));
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
$feed = Mage::getModel('eems_affiliate/feed_order_itemized');
$this->assertSame(array('one', 'two', 'three'), EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFeedFields'));
}
示例9: testConfigurationSavedIfModuleNotInstalled
public function testConfigurationSavedIfModuleNotInstalled()
{
$imagemagickMock = $this->getMock('Varien_Image_Adapter_Imagemagic', array('checkDependencies'));
$imagemagickMock->expects($this->any())->method('checkDependencies')->will($this->returnValue(true));
$this->_model->setImageAdapter($imagemagickMock);
$this->_model->setValue(Varien_Image_Adapter::ADAPTER_GD2);
EcomDev_Utils_Reflection::invokeRestrictedMethod($this->_model, '_beforeSave');
$this->assertEquals(Varien_Image_Adapter::ADAPTER_GD2, $this->_model->getValue());
}
示例10: testGetTenderTypeLookupApi
public function testGetTenderTypeLookupApi()
{
$service = 'payments';
$operation = 'tendertype/lookup';
$tenderTypeHelper = $this->getHelperMockBuilder('ebayenterprise_giftcard/tendertype')->setMethods(null)->setConstructorArgs([$this->constructorArgs])->getMock();
$this->api = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi')->getMockForAbstractClass();
$this->coreHelper->expects($this->once())->method('getSdkApi')->with($this->identicalTo($service), $this->identicalTo($operation), $this->identicalTo([]), $this->identicalTo($this->apiLogger))->will($this->returnValue($this->api));
$this->assertSame($this->api, EcomDev_Utils_Reflection::invokeRestrictedMethod($tenderTypeHelper, 'getTenderTypeLookupApi'));
}
示例11: testGetItemId
/**
* Create the item's identifier by using the sku, client id and catalog id
* of the item to create an ID.
*/
public function testGetItemId()
{
$item = $this->getModelMockBuilder('ebayenterprise_catalog/pim_product')->disableOriginalConstructor()->setMethods(array('getSku', 'getClientId', 'getCatalogId'))->getMock();
$collection = $this->getModelMock('ebayenterprise_catalog/pim_product_collection', array('_formatId'));
$item->expects($this->once())->method('getSku')->will($this->returnValue('45-12345'));
$item->expects($this->once())->method('getClientId')->will($this->returnValue('clientId'));
$item->expects($this->once())->method('getCatalogId')->will($this->returnValue('catalogId'));
$collection->expects($this->once())->method('_formatId')->with($this->identicalTo('45-12345'), $this->identicalTo('clientId'), $this->identicalTo('catalogId'))->will($this->returnValue('45-12345-clientId-catalogId'));
$this->assertSame('45-12345-clientId-catalogId', EcomDev_Utils_Reflection::invokeRestrictedMethod($collection, '_getItemId', array($item)));
}
示例12: testGetStockMap
/**
* Test EbayEnterprise_Catalog_Helper_Map_Stock::_getStockMap method with the following expectations
* Expectation 1: when this test invoked this method EbayEnterprise_Catalog_Helper_Map_Stock::_getStockMap
* will set the class property EbayEnterprise_Catalog_Helper_Map_Stock::_StockMap with an
* array of ROM SalesClass values mapped to valid (we hope) Magento_CatalogInventory_Model_Stock::BACKORDER_xxx value
*/
public function testGetStockMap()
{
$mapData = array('advanceOrderOpen' => 1, 'advanceOrderLimited' => 2);
$configRegistryMock = $this->getModelMock('eb2ccore/config_registry', array('getConfigData'));
$configRegistryMock->expects($this->once())->method('getConfigData')->with($this->identicalTo(EbayEnterprise_Catalog_Helper_Map_Stock::STOCK_CONFIG_PATH))->will($this->returnValue($mapData));
$this->replaceByMock('model', 'eb2ccore/config_registry', $configRegistryMock);
$stock = Mage::helper('ebayenterprise_catalog/map_stock');
EcomDev_Utils_Reflection::setRestrictedPropertyValue($stock, '_stockMap', array());
$this->assertSame($mapData, EcomDev_Utils_Reflection::invokeRestrictedMethod($stock, '_getStockMap', array()));
}
示例13: testSortOrdersMostRecentFirst
/**
* Test that the method ebayenterprise_order/search_process_response_collection::_sortOrdersMostRecentFirst()
* is invoked, and it will be passed in an object of type Varien_Object as parameter 1 and 2. When the
* Varien_Object instance of parameter one has an order date greater and the Varien_Object instance of
* parameter two, then the method ebayenterprise_order/search_process_response_collection::_sortOrdersMostRecentFirst()
* will return boolean false, otherwise it will return true.
*
* @param string
* @param string
* @param bool
* @dataProvider providerSortOrdersMostRecentFirst
*/
public function testSortOrdersMostRecentFirst($orderDateA, $orderDateB, $result)
{
/** @var EbayEnterprise_Order_Model_Search_Process_Response_ICollection */
$collection = Mage::getModel('ebayenterprise_order/search_process_response_collection');
/** @var Varien_Object */
$varienObjectA = new Varien_Object(['order_date' => $orderDateA]);
/** @var Varien_Object */
$varienObjectB = new Varien_Object(['order_date' => $orderDateB]);
$this->assertSame($result, EcomDev_Utils_Reflection::invokeRestrictedMethod($collection, '_sortOrdersMostRecentFirst', [$varienObjectA, $varienObjectB]));
}
示例14: testConstructInvalidArguments
/**
* verify an exception is thrown when missing arguments
*/
public function testConstructInvalidArguments()
{
$expectedException = sprintf(EbayEnterprise_Catalog_Model_Pim_Product::ERROR_INVALID_ARGS, 'EbayEnterprise_Catalog_Model_Pim_Product::_construct', 'client_id, catalog_id, sku');
$initParams = array();
$this->setExpectedException('Exception', $expectedException);
$helper = $this->getHelperMockBuilder('eb2ccore/data')->disableOriginalConstructor()->setMethods(array('triggerError'))->getMock();
$helper->expects($this->once())->method('triggerError')->with($this->identicalTo($expectedException))->will($this->throwException(new Exception($expectedException)));
$this->replaceByMock('helper', 'eb2ccore', $helper);
$product = $this->getModelMockBuilder('ebayenterprise_catalog/pim_product')->disableOriginalConstructor()->setMethods(null)->getMock();
EcomDev_Utils_Reflection::invokeRestrictedMethod($product, '_construct', array($initParams));
}
示例15: testAfterLoad
/**
* Test getting the last saved test message timestamp to be displayed in the
* admin.
* @param string|null $timestamp
* @param string $value
* @dataProvider provideLastTimestamp
*/
public function testAfterLoad($lastTimestamp, $value)
{
// suppression the real session from starting
$session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
$this->replaceByMock('singleton', 'core/session', $session);
$helper = $this->getHelperMock('ebayenterprise_amqp/data');
$helper->expects($this->any())->method('__')->will($this->returnArgument(0));
$lasttestmessage = Mage::getModel('ebayenterprise_amqp/adminhtml_system_config_backend_lasttestmessage', array('value' => $lastTimestamp, 'helper' => $helper));
EcomDev_Utils_Reflection::invokeRestrictedMethod($lasttestmessage, '_afterLoad');
$this->assertSame($value, $lasttestmessage->getValue());
}