• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP EcomDev_Utils_Reflection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中EcomDev_Utils_Reflection的典型用法代码示例。如果您正苦于以下问题:PHP EcomDev_Utils_Reflection类的具体用法?PHP EcomDev_Utils_Reflection怎么用?PHP EcomDev_Utils_Reflection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了EcomDev_Utils_Reflection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _handleScopeRow

 /**
  * Handle scope row data
  *
  * @param string $type
  * @param array $row
  * @param EcomDev_PHPUnit_Model_FixtureInterface $fixture
  * @return boolean|Mage_Core_Model_Abstract
  */
 protected function _handleScopeRow($type, $row, EcomDev_PHPUnit_Model_FixtureInterface $fixture)
 {
     $previousScope = array();
     if ($fixture->isScopeLocal() && $fixture->getStorageData(self::STORAGE_KEY, EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED) !== null) {
         $previousScope = $fixture->getStorageData(self::STORAGE_KEY, EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED);
     }
     if (isset($previousScope[$type][$row[$type . '_id']])) {
         return false;
     }
     $scopeModel = Mage::getModel($this->modelByType[$type]);
     $scopeModel->setData($row);
     // Change property for saving new objects with specified ids
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => false));
     try {
         $scopeModel->isObjectNew(true);
         $scopeModel->save();
     } catch (Exception $e) {
         Mage::logException($e);
         // Skip duplicated key violation, since it might be a problem
         // of previous run with fatal error
         // Revert changed property
         EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => true));
         // Load to make possible deletion
         $scopeModel->load($row[$type . '_id']);
     }
     // Revert changed property
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => true));
     return $scopeModel;
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:37,代码来源:Scope.php


示例2: setUp

 public function setUp()
 {
     $this->_helper = $this->getHelperMock('ebayenterprise_giftcard/data');
     $this->_helper->expects($this->any())->method('__')->with($this->isType('string'))->will($this->returnArgument(0));
     // disable constructor to prevent having to mock dependencies
     $this->_checkoutSession = $this->getModelMockBuilder('checkout/session')->disableOriginalConstructor()->setMethods(array('addError'))->getMock();
     // disable constructor to prevent having to mock dependencies
     $this->_giftCardSession = $this->getModelMockBuilder('ebayenterprise_giftcard/session')->disableOriginalConstructor()->setMethods(array('setEbayEnterpriseCurrentGiftCard'))->getMock();
     // disable constructor to avoid mocking dependencies
     $this->_request = $this->getMockBuilder('Mage_Core_Controller_Request_Http')->disableOriginalConstructor()->getMock();
     $this->_request->expects($this->any())->method('getParam')->will($this->returnValueMap(array(array(self::CARDNUMBER_FIELD, '', $this->_giftCardNumber), array(self::PIN_FIELD, '', $this->_giftCardPin))));
     $this->_giftCard = $this->getMock('EbayEnterprise_GiftCard_Model_IGiftcard');
     $this->_giftCard->expects($this->any())->method('setPin')->with($this->isType('string'))->will($this->returnSelf());
     // disable constructor to avoid mocking dependencies
     $this->_container = $this->getMockBuilder('EbayEnterprise_GiftCard_Model_IContainer')->disableOriginalConstructor()->getMock();
     // use value map so that if anything other than the giftcard number and pin are passed in,
     // the function will return null. so tests should fail if a change breaks assumptions about
     // getGiftCard's arguments.
     $this->_container->expects($this->any())->method('getGiftCard')->will($this->returnValueMap(array(array($this->_giftCardNumber, $this->_giftCard))));
     // disable constructor to avoid mocking dependencies
     $this->_controller = $this->getMockBuilder('EbayEnterprise_GiftCard_Controller_Abstract')->disableOriginalConstructor()->setMethods(array('_redirect', 'loadLayout', 'renderLayout', 'setFlag'))->getMock();
     // inject mocked dependencies
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->_controller, '_container', $this->_container);
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->_controller, '_helper', $this->_helper);
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->_controller, '_request', $this->_request);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:26,代码来源:AbstractTest.php


示例3: 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]);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:17,代码来源:AllocatorTest.php


示例4: testGetCookiesString

 /**
  * verify the cookie array is converted to a string
  * @dataProvider provideCookieArray
  */
 public function testGetCookiesString(array $arr, $expected)
 {
     $helper = Mage::helper('eb2cfraud/http');
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($helper, ['_request' => $this->_requestStub, '_cookie' => $this->_cookieStub]);
     $this->_cookieStub->expects($this->any())->method('get')->will($this->returnValue($arr));
     $this->assertSame($expected, $helper->getCookiesString());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:11,代码来源:HttpTest.php


示例5: testGetDefaultData

 /**
  *
  *
  * @param string $type
  * @param array $requiredKeys
  * @dataProvider dataProvider
  * @loadFixture config
  */
 public function testGetDefaultData($type, $requiredKeys)
 {
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->processor, 'requiredKeys', $requiredKeys);
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->processor, 'type', $type);
     $dataSet = $this->readAttribute($this, 'dataName');
     $this->assertEquals($this->expected($dataSet)->getData(), $this->processor->getDefaultData());
 }
开发者ID:p-makowski,项目名称:Hackathon-FixtureGenerator,代码行数:15,代码来源:Abstract.php


示例6: 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');
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:12,代码来源:ResponseTest.php


示例7: 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);
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:18,代码来源:Script.php


示例8: tearDown

 protected function tearDown()
 {
     // Restore the original inventory helper instance to the payload helper
     // to prevent the mock form potentially polluting other tests with
     // unexpected mock behavior.
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->payloadHelper, 'inventoryHelper', $this->origInventoryHelper);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:7,代码来源:PayloadTest.php


示例9: __construct

 /**
  * Constructor adds test groups defined on global level
  * and adds additional logic for test names retrieval
  *
  * @see PHPUnit_Framework_TestSuite::__construct()
  */
 public function __construct($theClass = '', $groups = array())
 {
     if (!$theClass instanceof ReflectionClass) {
         $theClass = EcomDev_Utils_Reflection::getReflection($theClass);
     }
     // Check annotations for test case name
     $annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($theClass->getName());
     if (isset($annotations['name'])) {
         $this->suiteName = $annotations['name'];
     }
     // Creates all test instances
     parent::__construct($theClass);
     // Just sort-out them by our internal groups
     foreach ($groups as $group) {
         $this->groups[$group] = $this->tests();
     }
     foreach ($this->tests() as $test) {
         if ($test instanceof PHPUnit_Framework_TestSuite) {
             /* @todo
              * Post an issue into PHPUnit bugtracker for
              * impossibility for specifying group by parent test case
              * Because it is a very dirty hack :(
              **/
             $testGroups = array();
             foreach ($groups as $group) {
                 $testGroups[$group] = $test->tests();
             }
             EcomDev_Utils_Reflection::setRestrictedPropertyValue($test, 'groups', $testGroups);
         }
     }
     // Remove un grouped tests group, if it exists
     if (isset($this->groups[self::NO_GROUP_KEYWORD])) {
         unset($this->groups[self::NO_GROUP_KEYWORD]);
     }
 }
开发者ID:cmuench,项目名称:EcomDev_PHPUnit,代码行数:41,代码来源:Group.php


示例10: 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);
 }
开发者ID:sergeykalenyuk,项目名称:Perfect_Watermarks,代码行数:7,代码来源:Image.php


示例11: 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]));
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:18,代码来源:OrderitemTest.php


示例12: 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'));
 }
开发者ID:adamhobson,项目名称:magento-eems-affiliate,代码行数:14,代码来源:ItemizedTest.php


示例13: testRemoveMethod

 public function testRemoveMethod()
 {
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->mockProxy, 'methods', array('methodName', 'methodName2', 'methodName3'));
     $this->mockProxy->removeMethod('methodName2');
     $this->assertAttributeEquals(array('methodName', 'methodName3'), 'methods', $this->mockProxy);
     $this->mockProxy->removeMethod('methodName');
     $this->assertAttributeEquals(array('methodName3'), 'methods', $this->mockProxy);
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:8,代码来源:Proxy.php


示例14: 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'])));
     }
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:13,代码来源:GiftcardTest.php


示例15: 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());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:12,代码来源:ItemTest.php


示例16: 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'));
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:9,代码来源:TendertypeTest.php


示例17: 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());
 }
开发者ID:sergeykalenyuk,项目名称:Perfect_Watermarks,代码行数:9,代码来源:Adapter.php


示例18: 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]));
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:22,代码来源:CollectionTest.php


示例19: 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()));
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:16,代码来源:StockTest.php


示例20: tearDown

 public function tearDown()
 {
     $collection = $this->getProductSyncCronScheduleCollection();
     foreach ($collection as $item) {
         $item->delete();
     }
     $resource = Mage::getModel("core/resource");
     $resource->getConnection("core_write")->delete($resource->getTableName("klevu_search/order_sync"));
     EcomDev_Utils_Reflection::setRestrictedPropertyValue(Mage::getConfig(), "_classNameCache", array());
     parent::tearDown();
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:11,代码来源:Observer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Eden_Google_Error类代码示例发布时间:2022-05-23
下一篇:
PHP EcomDev_PHPUnit_Test_Case类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap