Exemple #1
0
 public function setUp()
 {
     $this->moduleFirst = $this->getMock('Magento\\Tools\\Dependency\\Report\\Framework\\Data\\Module', [], [], '', false);
     $this->moduleSecond = $this->getMock('Magento\\Tools\\Dependency\\Report\\Framework\\Data\\Module', [], [], '', false);
     $objectManagerHelper = new ObjectManager($this);
     $this->config = $objectManagerHelper->getObject('Magento\\Tools\\Dependency\\Report\\Framework\\Data\\Config', ['modules' => [$this->moduleFirst, $this->moduleSecond]]);
 }
 public function setUp()
 {
     $this->customerFactory = $this->getMockBuilder('Magento\\Customer\\Model\\CustomerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $objectManager = new ObjectManager($this);
     $this->customerRegistry = $objectManager->getObject('Magento\\Customer\\Model\\CustomerRegistry', ['customerFactory' => $this->customerFactory]);
     $this->customer = $this->getMockBuilder('Magento\\Customer\\Model\\Customer')->disableOriginalConstructor()->setMethods(['load', 'getId', 'getEmail', 'getWebsiteId', '__wakeup', 'setEmail', 'setWebsiteId', 'loadByEmail'])->getMock();
 }
Exemple #3
0
 protected function setUp()
 {
     $this->scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->requestMock = $this->getMock('Magento\\Framework\\App\\Request\\Http', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->designExceptions = $this->objectManagerHelper->getObject('Magento\\Framework\\View\\DesignExceptions', ['scopeConfig' => $this->scopeConfigMock, 'exceptionConfigPath' => $this->exceptionConfigPath, 'scopeType' => $this->scopeType]);
 }
Exemple #4
0
 protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->requestBucket = $this->getMockBuilder('Magento\\Framework\\Search\\Request\\BucketInterface')->setMethods(['getMetrics'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->metric = $this->getMockBuilder('Magento\\Framework\\Search\\Request\\Aggregation\\Metric')->setMethods(['getType'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->metrics = $helper->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\Aggregation\\Builder\\Metrics');
 }
Exemple #5
0
 protected function setUp()
 {
     $log = $this->getMock('Magento\\Log\\Model\\Log', ['getOnlineMinutesInterval'], [], '', false);
     $log->expects($this->any())->method('getOnlineMinutesInterval')->will($this->returnValue(1));
     $this->customerLog = $this->getMockBuilder('Magento\\Log\\Model\\Customer')->disableOriginalConstructor()->setMethods(['getLoginAt', 'getLoginAtTimestamp', 'loadByCustomer', 'getLogoutAt', 'getLastVisitAt'])->getMock();
     $this->customerLog->expects($this->any())->method('loadByCustomer')->will($this->returnSelf());
     $this->logFactory = $this->getMockBuilder('Magento\\Log\\Model\\CustomerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->logFactory->expects($this->any())->method('create')->will($this->returnValue($this->customerLog));
     $dateTime = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime')->setMethods(['now'])->disableOriginalConstructor()->getMock();
     $dateTime->expects($this->any())->method('now')->will($this->returnCallback(function () {
         return date('Y-m-d H:i:s');
     }));
     $customer = $this->getMock('\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $customer->expects($this->any())->method('getId')->will($this->returnValue(1));
     $customer->expects($this->any())->method('getStoreId')->will($this->returnValue(1));
     $customerData = ['account' => ['id' => 1, 'store_id' => 1]];
     $customerBuilder = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\CustomerDataBuilder')->setMethods(['populateWithArray', 'create'])->disableOriginalConstructor()->getMock();
     $customerBuilder->expects($this->any())->method('populateWithArray')->will($this->returnSelf());
     $customerBuilder->expects($this->any())->method('create')->will($this->returnValue($customer));
     $backendSession = $this->getMockBuilder('\\Magento\\Backend\\Model\\Session')->setMethods(['getCustomerData'])->disableOriginalConstructor()->getMock();
     $backendSession->expects($this->any())->method('getCustomerData')->will($this->returnValue($customerData));
     $this->localeDate = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\Timezone')->setMethods(['scopeDate', 'formatDate', 'getDefaultTimezonePath'])->disableOriginalConstructor()->getMock();
     $this->localeDate->expects($this->any())->method('getDefaultTimezonePath')->will($this->returnValue('path/to/default/timezone'));
     $this->scopeConfig = $this->getMockBuilder('Magento\\Framework\\App\\Config')->setMethods(['getValue'])->disableOriginalConstructor()->getMock();
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->block = $objectManagerHelper->getObject('Magento\\Log\\Block\\Adminhtml\\Customer\\Edit\\Tab\\View\\Status', ['logFactory' => $this->logFactory, 'localeDate' => $this->localeDate, 'scopeConfig' => $this->scopeConfig, 'modelLog' => $log, 'dateTime' => $dateTime, 'customerBuilder' => $customerBuilder, 'backendSession' => $backendSession]);
 }
Exemple #6
0
 protected function setUp()
 {
     $this->urlInterface = $this->getMock('Magento\\Framework\\UrlInterface');
     $this->scopeConfigInterface = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->urlBuilder = $objectManagerHelper->getObject('Magento\\Rss\\Model\\UrlBuilder', ['urlBuilder' => $this->urlInterface, 'scopeConfig' => $this->scopeConfigInterface]);
 }
Exemple #7
0
 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     /** @var \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory */
     $this->filterItemFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\ItemFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     /** @var \Magento\Framework\Store\StoreManagerInterface $storeManager */
     $this->storeManager = $this->getMockBuilder('\\Magento\\Framework\\Store\\StoreManagerInterface')->disableOriginalConstructor()->setMethods([])->getMockForAbstractClass();
     /** @var \Magento\Catalog\Model\Layer $layer */
     $this->layer = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer')->disableOriginalConstructor()->setMethods(['getState'])->getMock();
     /** @var \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder */
     $this->itemDataBuilder = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\Item\\DataBuilder')->disableOriginalConstructor()->setMethods(['addItemData', 'build'])->getMock();
     $this->filterAttribute = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Resource\\Layer\\Filter\\Attribute')->disableOriginalConstructor()->setMethods(['getCount', 'applyFilterToCollection'])->getMock();
     $this->filterAttribute->expects($this->any())->method('applyFilterToCollection')->will($this->returnSelf());
     $this->filterAttributeFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Resource\\Layer\\Filter\\AttributeFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->filterAttributeFactory->expects($this->once())->method('create')->will($this->returnValue($this->filterAttribute));
     $this->state = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\State')->disableOriginalConstructor()->setMethods(['addFilter'])->getMock();
     $this->layer->expects($this->any())->method('getState')->will($this->returnValue($this->state));
     $this->frontend = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute\\Frontend\\AbstractFrontend')->disableOriginalConstructor()->setMethods(['getOption', 'getSelectOptions'])->getMock();
     $this->attribute = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute')->disableOriginalConstructor()->setMethods(['getAttributeCode', 'getFrontend', 'getIsFilterable'])->getMock();
     $this->attribute->expects($this->atLeastOnce())->method('getFrontend')->will($this->returnValue($this->frontend));
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods([])->getMockForAbstractClass();
     $stripTagsFilter = $this->getMockBuilder('\\Magento\\Framework\\Filter\\StripTags')->disableOriginalConstructor()->setMethods(['filter'])->getMock();
     $stripTagsFilter->expects($this->any())->method('filter')->will($this->returnArgument(0));
     $string = $this->getMockBuilder('\\Magento\\Framework\\Stdlib\\String')->disableOriginalConstructor()->setMethods(['strlen'])->getMock();
     $string->expects($this->any())->method('strlen')->will($this->returnCallback(function ($value) {
         return strlen($value);
     }));
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->target = $objectManagerHelper->getObject('Magento\\Catalog\\Model\\Layer\\Filter\\Attribute', ['filterItemFactory' => $this->filterItemFactory, 'storeManager' => $this->storeManager, 'layer' => $this->layer, 'itemDataBuilder' => $this->itemDataBuilder, 'filterAttributeFactory' => $this->filterAttributeFactory, 'tagFilter' => $stripTagsFilter, 'string' => $string]);
 }
Exemple #8
0
 protected function setUp()
 {
     $this->sendfriendModel = $this->getMock('Magento\\Sendfriend\\Model\\Sendfriend', ['__wakeup', 'canEmailToFriend'], [], '', false);
     $this->productView = $this->getMock('Magento\\Catalog\\Block\\Product\\View', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->view = $this->objectManagerHelper->getObject('Magento\\Sendfriend\\Block\\Plugin\\Catalog\\Product\\View', ['sendfriend' => $this->sendfriendModel]);
 }
Exemple #9
0
 /**
  * @dataProvider notIsValidDataProvider
  * @param $data
  * @param $result
  */
 public function testNotIsValid($data, $result)
 {
     $provider = $this->getMockForAbstractClass('Magento\\Checkout\\Model\\Agreements\\AgreementsProviderInterface');
     $provider->expects($this->once())->method('getRequiredAgreementIds')->will($this->returnValue([1, 3, '4']));
     $this->object = $this->objectManagerHelper->getObject('Magento\\Checkout\\Model\\Agreements\\AgreementsValidator', ['list' => [$provider]]);
     $this->assertEquals($result, $this->object->isValid($data));
 }
 protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->documentFactory = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\DocumentFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->objectManager = $this->getMockBuilder('\\Magento\\Framework\\ObjectManager')->setMethods(['create'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->factory = $helper->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\ResponseFactory', ['documentFactory' => $this->documentFactory, 'objectManager' => $this->objectManager]);
 }
Exemple #11
0
 public function setUp()
 {
     $this->productRepository = $this->getMockBuilder('Magento\\Catalog\\Model\\ProductRepository')->disableOriginalConstructor()->getMock();
     $this->productConverter = $this->getMockBuilder('Magento\\Catalog\\Service\\V1\\Data\\Converter')->disableOriginalConstructor()->getMock();
     $this->objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->object = $this->objectManagerHelper->getObject('Magento\\ConfigurableProduct\\Service\\V1\\Product\\Link\\ReadService', ['productRepository' => $this->productRepository, 'productConverter' => $this->productConverter]);
 }
Exemple #12
0
 protected function setUp()
 {
     $this->objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->pageFactory = $this->objectManagerHelper->getObject('Magento\\Framework\\View\\Result\\PageFactory', ['objectManager' => $this->objectManagerMock]);
     $this->page = $this->getMockBuilder('Magento\\Framework\\View\\Result\\Page')->disableOriginalConstructor()->getMock();
 }
Exemple #13
0
 protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->objectManager = $this->getMockBuilder('Magento\\Framework\\ObjectManager')->setMethods(['create', 'get', 'configure'])->disableOriginalConstructor()->getMock();
     $this->config = $this->getMockBuilder('Magento\\Framework\\Search\\Request\\Config')->disableOriginalConstructor()->getMock();
     $this->factory = $helper->getObject('Magento\\Framework\\Search\\RequestFactory', ['objectManager' => $this->objectManager, 'config' => $this->config]);
 }
Exemple #14
0
 public function setUp()
 {
     $this->dependencyFirst = $this->getMock('Magento\\Tools\\Dependency\\Report\\Dependency\\Data\\Dependency', array(), array(), '', false);
     $this->dependencySecond = $this->getMock('Magento\\Tools\\Dependency\\Report\\Dependency\\Data\\Dependency', array(), array(), '', false);
     $objectManagerHelper = new ObjectManager($this);
     $this->module = $objectManagerHelper->getObject('Magento\\Tools\\Dependency\\Report\\Dependency\\Data\\Module', array('name' => 'name', 'dependencies' => array($this->dependencyFirst, $this->dependencySecond)));
 }
Exemple #15
0
 /**
  * @param bool $isSecure
  * @param array $metadata
  * @param bool $expected
  * @param int $callNum
  * @dataProvider toArrayDataProvider
  */
 public function testToArray($isSecure, $metadata, $expected, $callNum = 1)
 {
     $this->requestMock->expects($this->exactly($callNum))->method('isSecure')->willReturn($isSecure);
     /** @var \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata $object */
     $object = $this->objectManager->getObject('Magento\\Framework\\Stdlib\\Cookie\\SensitiveCookieMetadata', ['request' => $this->requestMock, 'metadata' => $metadata]);
     $this->assertEquals($expected, $object->__toArray());
 }
Exemple #16
0
 protected function setUp()
 {
     $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false);
     $this->rssManagerInterface = $this->getMock('Magento\\Framework\\App\\Rss\\RssManagerInterface');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->block = $this->objectManagerHelper->getObject('Magento\\Rss\\Block\\Feeds', ['context' => $this->context, 'rssManager' => $this->rssManagerInterface]);
 }
Exemple #17
0
 public function testGetDefaultGroup()
 {
     $this->assertEquals(ManagerInterface::DEFAULT_GROUP, $this->model->getDefaultGroup());
     $customDefaultGroup = 'some_group';
     $customManager = $this->objectManager->getObject('Magento\\Framework\\Message\\Manager', ['defaultGroup' => $customDefaultGroup]);
     $this->assertEquals($customDefaultGroup, $customManager->getDefaultGroup());
 }
Exemple #18
0
 protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->scoreBuilder = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\ScoreBuilder')->setMethods(['addCondition'])->disableOriginalConstructor()->getMock();
     $this->resolver = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\Field\\ResolverInterface')->setMethods(['resolve'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->match = $helper->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\Query\\Builder\\Match', ['resolver' => $this->resolver]);
 }
Exemple #19
0
 /**
  * @dataProvider getPropertiesDataProvider
  */
 public function testGetProperties($queryText, $resultsCount)
 {
     /** @var \Magento\Search\Model\QueryResult $queryResult */
     $queryResult = $this->objectManager->getObject('Magento\\Search\\Model\\QueryResult', ['queryText' => $queryText, 'resultsCount' => $resultsCount]);
     $this->assertEquals($queryText, $queryResult->getQueryText());
     $this->assertEquals($resultsCount, $queryResult->getResultsCount());
 }
Exemple #20
0
 public function setUp()
 {
     $this->orderFactory = $this->getMock('\\Magento\\Sales\\Model\\OrderFactory', ['create'], [], '', false);
     $objectManagerHelper = new ObjectManagerHelper($this);
     $arguments = ['context' => $this->getMock('Magento\\Framework\\Model\\Context', [], [], '', false), 'registry' => $this->getMock('Magento\\Framework\\Registry', [], [], '', false), 'localeDate' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface', [], [], '', false), 'dateTime' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime', [], [], '', false), 'creditmemoConfig' => $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo\\Config', [], [], '', false), 'orderFactory' => $this->orderFactory, 'cmItemCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Creditmemo\\Item\\CollectionFactory', [], [], '', false), 'calculatorFactory' => $this->getMock('Magento\\Framework\\Math\\CalculatorFactory', [], [], '', false), 'storeManager' => $this->getMock('Magento\\Store\\Model\\StoreManagerInterface', [], [], '', false), 'commentFactory' => $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo\\CommentFactory', [], [], '', false), 'commentCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Creditmemo\\Comment\\CollectionFactory', [], [], '', false)];
     $this->creditmemo = $objectManagerHelper->getObject('Magento\\Sales\\Model\\Order\\Creditmemo', $arguments);
 }
Exemple #21
0
 /**
  * Test for getLicenseHtml when EULA file name is empty
  *
  * @dataProvider getLicenseHtmlWhenFileIsEmptyDataProvider
  *
  * @param $fileName
  */
 public function testGetLicenseHtmlWhenFileIsEmpty($fileName)
 {
     $fileSystem = $this->getMock('Magento\\Framework\\App\\Filesystem', array(), array(), '', false);
     $fileSystem->expects($this->never())->method('read');
     $block = $this->_objectManager->getObject('Magento\\Install\\Block\\Begin', array('filesystem' => $fileSystem, 'eulaFile' => $fileName));
     $this->assertEquals('', $block->getLicenseHtml());
 }
Exemple #22
0
 protected function setUp()
 {
     $this->pageConfigMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config')->disableOriginalConstructor()->getMock();
     $this->title = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock();
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->headGenerator = $objectManagerHelper->getObject('Magento\\Framework\\View\\Page\\Config\\Generator\\Head', ['pageConfig' => $this->pageConfigMock]);
 }
Exemple #23
0
 protected function setUp()
 {
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->linkFactory = $this->getMockBuilder('\\Magento\\Downloadable\\Model\\LinkFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->linkResource = $this->getMockBuilder('\\Magento\\Downloadable\\Model\\Resource\\Link')->disableOriginalConstructor()->setMethods(['deleteItems'])->getMock();
     $this->target = $objectManagerHelper->getObject('Magento\\Downloadable\\Model\\Product\\TypeHandler\\Link', ['linkFactory' => $this->linkFactory, 'linkResource' => $this->linkResource]);
 }
Exemple #24
0
 public function setUp()
 {
     $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->categoryTreeMock = $this->getMockBuilder('Magento\\Catalog\\Service\\V1\\Data\\Category\\Tree')->disableOriginalConstructor()->getMock();
     $this->categoryFactoryMock = $this->getMockBuilder('\\Magento\\Catalog\\Model\\CategoryFactory')->disableOriginalConstructor()->setMethods(['create', 'load'])->getMock();
     $this->categoryService = $this->objectManager->getObject('\\Magento\\Catalog\\Service\\V1\\Category\\Tree\\ReadService', ['categoryFactory' => $this->categoryFactoryMock, 'categoryTree' => $this->categoryTreeMock]);
 }
Exemple #25
0
 public function testGetFormHtmlId()
 {
     $formMock = $this->getMock('Magento\\Framework\\Data\\Form', ['getHtmlIdPrefix'], [], '', false);
     $formMock->expects($this->once())->method('getHtmlIdPrefix')->will($this->returnValue('account_form'));
     $this->block = $this->objectManagerHelper->getObject('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Sendemail', ['context' => $this->contextMock, 'data' => ['form' => $formMock]]);
     $this->assertEquals('account_form', $this->block->getFormHtmlId());
 }
Exemple #26
0
 public function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->sendfriendDataMock = $this->getMockBuilder('Magento\\Sendfriend\\Helper\\Data')->disableOriginalConstructor()->getMock();
     $this->cookieManagerMock = $this->getMock('Magento\\Framework\\Stdlib\\CookieManagerInterface');
     $this->model = $objectManager->getObject('Magento\\Sendfriend\\Model\\Sendfriend', ['sendfriendData' => $this->sendfriendDataMock, 'cookieManager' => $this->cookieManagerMock]);
 }
Exemple #27
0
 protected function setUp()
 {
     $this->dateTime = $this->getMock('Magento\\Framework\\Stdlib\\DateTime');
     $this->collectionFactory = $this->getMock('Magento\\SalesRule\\Model\\Resource\\Rule\\CollectionFactory', ['create'], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->discounts = $this->objectManagerHelper->getObject('Magento\\SalesRule\\Model\\Rss\\Discounts', ['dateTime' => $this->dateTime, 'collectionFactory' => $this->collectionFactory]);
 }
Exemple #28
0
 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods(['getParam'])->getMockForAbstractClass();
     $dataProviderFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\DataProvider\\PriceFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->dataProvider = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\DataProvider\\Price')->disableOriginalConstructor()->setMethods(['setPriceId', 'getPrice', 'getResource'])->getMock();
     $this->resource = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Resource\\Layer\\Filter\\Price')->disableOriginalConstructor()->setMethods(['applyPriceRange'])->getMock();
     $this->dataProvider->expects($this->any())->method('getResource')->will($this->returnValue($this->resource));
     $dataProviderFactory->expects($this->once())->method('create')->will($this->returnValue($this->dataProvider));
     $this->layer = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer')->disableOriginalConstructor()->setMethods(['getState'])->getMock();
     $this->state = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\State')->disableOriginalConstructor()->setMethods(['addFilter'])->getMock();
     $this->layer->expects($this->any())->method('getState')->will($this->returnValue($this->state));
     $this->itemDataBuilder = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\Item\\DataBuilder')->disableOriginalConstructor()->setMethods(['addItemData', 'build'])->getMock();
     $this->filterItemFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\ItemFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $filterItem = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\Item')->disableOriginalConstructor()->setMethods(['setFilter', 'setLabel', 'setValue', 'setCount'])->getMock();
     $filterItem->expects($this->any())->method($this->anything())->will($this->returnSelf());
     $this->filterItemFactory->expects($this->any())->method('create')->will($this->returnValue($filterItem));
     $escaper = $this->getMockBuilder('\\Magento\\Framework\\Escaper')->disableOriginalConstructor()->setMethods(['escapeHtml'])->getMock();
     $escaper->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
     $this->attribute = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute')->disableOriginalConstructor()->setMethods(['getAttributeCode', 'getFrontend', 'getIsFilterable'])->getMock();
     $algorithmFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\Dynamic\\AlgorithmFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->algorithm = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Layer\\Filter\\Dynamic\\Auto')->disableOriginalConstructor()->setMethods(['getItemsData'])->getMock();
     $algorithmFactory->expects($this->any())->method('create')->will($this->returnValue($this->algorithm));
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->target = $objectManagerHelper->getObject('Magento\\Catalog\\Model\\Layer\\Filter\\Price', ['dataProviderFactory' => $dataProviderFactory, 'layer' => $this->layer, 'itemDataBuilder' => $this->itemDataBuilder, 'filterItemFactory' => $this->filterItemFactory, 'escaper' => $escaper, 'algorithmFactory' => $algorithmFactory]);
 }
Exemple #29
0
 public function setUp()
 {
     $this->orderFactory = $this->getMock('\\Magento\\Sales\\Model\\OrderFactory', ['create'], [], '', false);
     $objectManagerHelper = new ObjectManagerHelper($this);
     $arguments = ['context' => $this->getMock('Magento\\Framework\\Model\\Context', [], [], '', false), 'registry' => $this->getMock('Magento\\Framework\\Registry', [], [], '', false), 'localeDate' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface', [], [], '', false), 'dateTime' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime', [], [], '', false), 'orderFactory' => $this->orderFactory, 'shipmentItemCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Item\\CollectionFactory', [], [], '', false), 'trackCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Track\\CollectionFactory', [], [], '', false), 'commentFactory' => $this->getMock('Magento\\Sales\\Model\\Order\\Shipment\\CommentFactory', [], [], '', false), 'commentCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Comment\\CollectionFactory', [], [], '', false)];
     $this->shipment = $objectManagerHelper->getObject('Magento\\Sales\\Model\\Order\\Shipment', $arguments);
 }
Exemple #30
0
 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', [], [], '', false);
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface');
     $this->managerInterfaceMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->configMock = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->entityFactoryMock2 = $this->getMock('Magento\\Eav\\Model\\EntityFactory', [], [], '', false);
     $this->helperMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Helper', [], [], '', false);
     $entity = $this->getMock('Magento\\Eav\\Model\\Entity\\AbstractEntity', [], [], '', false);
     $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false);
     $entity->expects($this->any())->method('getReadConnection')->will($this->returnValue($adapter));
     $entity->expects($this->any())->method('getDefaultAttributes')->will($this->returnValue([]));
     $this->universalFactoryMock = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->universalFactoryMock->expects($this->any())->method('create')->will($this->returnValue($entity));
     $this->storeManagerMock = $this->getMockForAbstractClass('Magento\\Framework\\Store\\StoreManagerInterface');
     $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnCallback(function ($store) {
         return is_object($store) ? $store : new \Magento\Framework\Object(['id' => 42]);
     }));
     $this->catalogHelperMock = $this->getMock('Magento\\Catalog\\Helper\\Data', [], [], '', false);
     $this->stateMock = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Product\\Flat\\State', [], [], '', false);
     $this->scopeConfigInterfaceMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->optionFactoryMock = $this->getMock('Magento\\Catalog\\Model\\Product\\OptionFactory', [], [], '', false);
     $this->urlMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Url', [], [], '', false);
     $this->timezoneInterfaceMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->sessionMock = $this->getMock('Magento\\Customer\\Model\\Session', [], [], '', false);
     $this->dateTimeMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->collection = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Resource\\Product\\Link\\Product\\Collection', ['entityFactory' => $this->entityFactoryMock, 'logger' => $this->loggerMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->managerInterfaceMock, 'eavConfig' => $this->configMock, 'resource' => $this->resourceMock, 'eavEntityFactory' => $this->entityFactoryMock2, 'resourceHelper' => $this->helperMock, 'universalFactory' => $this->universalFactoryMock, 'storeManager' => $this->storeManagerMock, 'catalogData' => $this->catalogHelperMock, 'catalogProductFlatState' => $this->stateMock, 'scopeConfig' => $this->scopeConfigInterfaceMock, 'productOptionFactory' => $this->optionFactoryMock, 'catalogUrl' => $this->urlMock, 'localeDate' => $this->timezoneInterfaceMock, 'customerSession' => $this->sessionMock, 'dateTime' => $this->dateTimeMock]);
 }