Esempio n. 1
0
 public function testGetTreeHasLevelField()
 {
     $rootId = \Magento\Catalog\Model\Category::TREE_ROOT_ID;
     $storeGroups = [];
     $storeId = 1;
     $rootLevel = 2;
     $level = 3;
     $this->collection->expects($this->any())->method('addAttributeToSelect')->willReturnMap([['url_key', false, $this->collection], ['is_anchor', false, $this->collection]]);
     $this->childNode->expects($this->atLeastOnce())->method('getLevel')->willReturn($level);
     $this->rootNode->expects($this->atLeastOnce())->method('getLevel')->willReturn($rootLevel);
     $this->rootNode->expects($this->once())->method('hasChildren')->willReturn(true);
     $this->rootNode->expects($this->once())->method('getChildren')->willReturn([$this->childNode]);
     $this->categoryTree->expects($this->once())->method('load')->with(null, 3)->willReturnSelf();
     $this->categoryTree->expects($this->atLeastOnce())->method('addCollectionData')->with($this->collection)->willReturnSelf();
     $this->categoryTree->expects($this->once())->method('getNodeById')->with($rootId)->willReturn($this->rootNode);
     $this->store->expects($this->atLeastOnce())->method('getId')->willReturn($storeId);
     $this->storeManager->expects($this->once())->method('getGroups')->willReturn($storeGroups);
     $this->storeManager->expects($this->atLeastOnce())->method('getStore')->willReturn($this->store);
     $this->context->expects($this->once())->method('getStoreManager')->willReturn($this->storeManager);
     $this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->context->expects($this->once())->method('getEscaper')->willReturn($this->escaper);
     $this->context->expects($this->once())->method('getEventManager')->willReturn($this->eventManager);
     /** @var \Magento\Widget\Block\Adminhtml\Widget\Catalog\Category\Chooser $chooser */
     $chooser = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject('Magento\\Widget\\Block\\Adminhtml\\Widget\\Catalog\\Category\\Chooser', ['categoryTree' => $this->categoryTree, 'context' => $this->context]);
     $chooser->setData('category_collection', $this->collection);
     $result = $chooser->getTree();
     $this->assertEquals($level, $result[0]['level']);
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param Context     $context
  * @param Registry    $registry
  * @param FormFactory $formFactory
  * @param SystemStore $systemStore
  * @param Config      $config
  */
 public function __construct(Context $context, Registry $registry, FormFactory $formFactory, SystemStore $systemStore, Config $config)
 {
     $this->systemStore = $systemStore;
     $this->storeManager = $context->getStoreManager();
     $this->config = $config;
     return parent::__construct($context, $registry, $formFactory);
 }
Esempio n. 3
0
 /**
  * @param Config $configHelper
  *
  */
 public function __construct(\ShipperHQ\Shipper\Helper\LogAssist $shipperLogger, \Magento\Backend\Block\Template\Context $context, \Magento\Framework\App\Config\MutableScopeConfigInterface $mutableConfig, \ShipperHQ\Shipper\Helper\Data $shipperDataHelper)
 {
     $this->shipperDataHelper = $shipperDataHelper;
     $this->storeManager = $context->getStoreManager();
     $this->shipperLogger = $shipperLogger;
     $this->mutableConfig = $mutableConfig;
 }
Esempio n. 4
0
 public function testIsSingleStoreMode()
 {
     $storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManager', ['isSingleStoreMode'], [], '', false);
     $storeManagerMock->expects($this->any())->method('isSingleStoreMode')->will($this->returnValue(true));
     $this->contextMock->expects($this->any())->method('getStoreManager')->will($this->returnValue($storeManagerMock));
     $this->block = $this->objectManagerHelper->getObject('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Sendemail', ['context' => $this->contextMock]);
     $this->assertTrue($this->block->isSingleStoreMode());
 }
Esempio n. 5
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\Data\FormFactory $formFactory
  * @param \Magento\Tax\Model\Rate\Source $rateSource
  * @param \Magento\Tax\Api\TaxRuleRepositoryInterface $ruleService
  * @param \Magento\Tax\Api\TaxClassRepositoryInterface $taxClassService
  * @param \Magento\Tax\Model\TaxClass\Source\Customer $customerTaxClassSource
  * @param \Magento\Tax\Model\TaxClass\Source\Product $productTaxClassSource
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, \Magento\Tax\Model\Rate\Source $rateSource, \Magento\Tax\Api\TaxRuleRepositoryInterface $ruleService, \Magento\Tax\Api\TaxClassRepositoryInterface $taxClassService, \Magento\Tax\Model\TaxClass\Source\Customer $customerTaxClassSource, \Magento\Tax\Model\TaxClass\Source\Product $productTaxClassSource, array $data = [])
 {
     $this->rateSource = $rateSource;
     $this->formKey = $context->getFormKey();
     $this->ruleService = $ruleService;
     $this->taxClassService = $taxClassService;
     $this->customerTaxClassSource = $customerTaxClassSource;
     $this->productTaxClassSource = $productTaxClassSource;
     parent::__construct($context, $registry, $formFactory, $data);
 }
Esempio n. 6
0
 /**
  * Set up
  *
  * @return void
  */
 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->contextMock = $this->getMock('Magento\\Backend\\Block\\Template\\Context', ['getRequest'], [], '', false);
     $this->backordersMock = $this->getMock('Magento\\CatalogInventory\\Model\\Source\\Backorders', [], [], '', false);
     $this->stockConfigurationMock = $this->getMockForAbstractClass('Magento\\CatalogInventory\\Api\\StockConfigurationInterface', [], '', false);
     $this->requestMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', ['getParam'], '', false);
     $this->contextMock->expects($this->once())->method('getRequest')->will($this->returnValue($this->requestMock));
     $this->inventory = $objectManager->getObject('Magento\\Catalog\\Block\\Adminhtml\\Product\\Edit\\Action\\Attribute\\Tab\\Inventory', ['context' => $this->contextMock, 'backorders' => $this->backordersMock, 'stockConfiguration' => $this->stockConfigurationMock]);
 }
Esempio n. 7
0
 protected function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Backend\\Block\\Template\\Context', [], [], '', false);
     $this->stockItemMock = $this->getMock('Magento\\CatalogInventory\\Service\\V1\\StockItemService', [], [], '', false);
     $this->registryMock = $this->getMock('Magento\\Framework\\Registry');
     $this->scopeConfig = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->contextMock->expects($this->once())->method('getScopeConfig')->will($this->returnValue($this->scopeConfig));
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->items = $this->objectManagerHelper->getObject('Magento\\Sales\\Block\\Adminhtml\\Order\\Creditmemo\\Create\\Items', ['context' => $this->contextMock, 'stockItemService' => $this->stockItemMock, 'registry' => $this->registryMock]);
 }
Esempio n. 8
0
 public function testGetHtmlNoCustomer()
 {
     $data = array('account' => array());
     $this->_context->getBackendSession()->setCustomerData($data);
     $this->_block = $this->_objectManager->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\Carts', '', array('context' => $this->_context));
     $html = $this->_block->toHtml();
     $this->assertContains("<div id=\"customer_cart_grid0\">", $html);
     $this->assertContains("<div class=\"grid-actions\">", $html);
     $this->assertContains("customer_cart_grid0JsObject = new varienGrid('customer_cart_grid0',", $html);
     $this->assertContains("backend/customer/cart_product_composite_cart/configure/website_id/0/key/", $html);
 }
Esempio n. 9
0
 public function testGetHtmlNoCustomer()
 {
     $data = ['account' => []];
     $this->_context->getBackendSession()->setCustomerData($data);
     $this->_block = $this->_objectManager->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\Carts', '', ['context' => $this->_context]);
     $html = $this->_block->toHtml();
     $this->assertContains("<div id=\"customer_cart_grid\"", $html);
     $this->assertRegExp('/<div class=".*admin__data-grid-toolbar"/', $html);
     $this->assertContains("customer_cart_gridJsObject = new varienGrid('customer_cart_grid',", $html);
     $this->assertContains("backend/customer/cart_product_composite_cart/configure/key/", $html);
 }
Esempio n. 10
0
 /**
  * Set up
  *
  * @return void
  */
 protected function setUp()
 {
     $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->contextMock = $this->getMock('Magento\\Backend\\Block\\Template\\Context', [], [], '', false);
     $this->categoryTreeMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Category\\Tree', [], [], '', false);
     $this->registryMock = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
     $this->categoryFactoryMock = $this->getMock('Magento\\Catalog\\Model\\CategoryFactory', [], [], '', false);
     $this->jsonEncoderMock = $this->getMockForAbstractClass('Magento\\Framework\\Json\\EncoderInterface', [], '', false);
     $this->requestMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getParam']);
     $this->contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->requestMock));
     $this->form = $this->objectManager->getObject('Magento\\Catalog\\Block\\Adminhtml\\Category\\Edit\\Form', ['context' => $this->contextMock, 'categoryTree' => $this->categoryTreeMock, 'registry' => $this->registryMock, 'categoryFactory' => $this->categoryFactoryMock, 'jsonEncoder' => $this->jsonEncoderMock]);
 }
Esempio n. 11
0
 protected function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Backend\\Block\\Template\\Context', [], [], '', false);
     $this->stockRegistry = $this->getMockBuilder('Magento\\CatalogInventory\\Model\\StockRegistry')->disableOriginalConstructor()->setMethods(['getStockItem', '__wakeup'])->getMock();
     $this->stockItemMock = $this->getMock('Magento\\CatalogInventory\\Model\\Stock\\Item', ['getManageStock', '__wakeup'], [], '', false);
     $this->stockConfiguration = $this->getMock('Magento\\CatalogInventory\\Model\\Configuration', ['__wakeup', 'canSubtractQty'], [], '', false);
     $this->stockRegistry->expects($this->any())->method('getStockItem')->will($this->returnValue($this->stockItemMock));
     $this->registryMock = $this->getMock('Magento\\Framework\\Registry');
     $this->scopeConfig = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->contextMock->expects($this->once())->method('getScopeConfig')->will($this->returnValue($this->scopeConfig));
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->items = $this->objectManagerHelper->getObject('Magento\\Sales\\Block\\Adminhtml\\Order\\Creditmemo\\Create\\Items', ['context' => $this->contextMock, 'stockRegistry' => $this->stockRegistry, 'stockConfiguration' => $this->stockConfiguration, 'registry' => $this->registryMock]);
 }
Esempio n. 12
0
 public function setUp()
 {
     $this->contextMock = $this->getMock('\\Magento\\Backend\\Block\\Template\\Context', [], [], '', false);
     $this->mathRandom = $this->getMock('\\Magento\\Framework\\Math\\Random', [], [], '', false);
     $this->urlBuilder = $this->getMock('\\Magento\\Framework\\UrlInterface', [], [], '', false);
     $this->contextMock->expects($this->any())->method('getMathRandom')->willReturn($this->mathRandom);
     $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilder);
     $this->registryMock = $this->getMock('\\Magento\\Framework\\Registry', [], [], '', false);
     $this->formFactoryMock = $this->getMock('\\Magento\\Framework\\Data\\FormFactory', [], [], '', false);
     $this->jsonEncoderMock = $this->getMock('\\Magento\\Framework\\Json\\EncoderInterface', [], [], '', false);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->block = $objectManager->getObject('\\Magento\\ProductVideo\\Block\\Adminhtml\\Product\\Edit\\NewVideo', ['context' => $this->contextMock, 'registry' => $this->registryMock, 'formFactory' => $this->formFactoryMock, 'jsonEncoder' => $this->jsonEncoderMock]);
 }
Esempio n. 13
0
 protected function setUp()
 {
     $this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class)->disableOriginalConstructor()->getMock();
     $this->contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
     $this->resourcePageMock = $this->getMockBuilder(PageResource::class)->disableOriginalConstructor()->setMethods(['getIdFieldName', 'checkIdentifier'])->getMock();
     $this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class)->disableOriginalConstructor()->getMock();
     $this->resourcesMock = $this->getMockBuilder(AbstractResource::class)->setMethods(['getIdFieldName', 'load', 'checkIdentifier'])->getMockForAbstractClass();
     $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)->getMockForAbstractClass();
     $this->contextMock->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventManagerMock);
     $this->resourcePageMock->expects($this->any())->method('getResources')->willReturn($this->resourcesMock);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->model = $objectManager->getObject(Page::class, ['context' => $this->contextMock, 'resource' => $this->resourcesMock]);
     $objectManager->setBackwardCompatibleProperty($this->model, 'scopeConfig', $this->scopeConfigMock);
 }
Esempio n. 14
0
 protected function tearDown()
 {
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->_customerSession->setCustomerId(null);
     $this->_context->getRequest()->setParam('id', $this->_requestId);
     /** @var \Magento\Customer\Model\AddressRegistry $addressRegistry */
     $addressRegistry = $objectManager->get('Magento\\Customer\\Model\\AddressRegistry');
     //Cleanup address from registry
     $addressRegistry->remove(1);
     $addressRegistry->remove(2);
     /** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */
     $customerRegistry = $objectManager->get('Magento\\Customer\\Model\\CustomerRegistry');
     //Cleanup customer from registry
     $customerRegistry->remove(1);
 }
 /**
  * @return \Magento\Customer\Api\Data\CustomerInterface
  */
 private function _loadCustomer()
 {
     $customer = $this->_customerRepository->getById(1);
     $data = ['account' => $this->_dataObjectProcessor->buildOutputDataArray($customer, 'Magento\\Customer\\Api\\Data\\CustomerInterface')];
     $this->_context->getBackendSession()->setCustomerData($data);
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId());
     return $customer;
 }
 /**
  * @return Customer
  */
 private function _loadCustomer()
 {
     $customer = $this->_customerAccountService->getCustomer(1);
     $data = array('account' => $customer->__toArray());
     $this->_context->getBackendSession()->setCustomerData($data);
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId());
     return $customer;
 }
Esempio n. 17
0
 /**
  * @return string
  */
 public function getActiveTitle()
 {
     if ($this->activeItem) {
         return $this->activeItem->getData('title');
     } else {
         return $this->context->getPageConfig()->getTitle()->getShort();
     }
 }
Esempio n. 18
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = array())
 {
     $this->_localeDate = $context->getLocaleDate();
     $this->_authorization = $context->getAuthorization();
     $this->mathRandom = $context->getMathRandom();
     $this->_backendSession = $context->getBackendSession();
     $this->formKey = $context->getFormKey();
     $this->nameBuilder = $context->getNameBuilder();
     parent::__construct($context, $data);
 }
Esempio n. 19
0
 /**
  * No data fixture nor is there a customer Id set in the registry.
  */
 public function testToHtmlNoCustomerId()
 {
     $this->coreRegistry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID);
     $customerData['account'] = array(Customer::FIRSTNAME => 'John', Customer::LASTNAME => 'Doe', Customer::EMAIL => '*****@*****.**', Customer::GROUP_ID => 1, Customer::WEBSITE_ID => 1);
     $customerData['address'] = array();
     $this->context->getBackendSession()->setCustomerData($customerData);
     $html = $this->block->toHtml();
     $this->assertNotContains('name="cart" title="Shopping Cart"', $html);
     $this->assertNotContains('name="wishlist" title="Wishlist"', $html);
     $this->assertStringMatchesFormat('%a name="account[firstname]" %s value="John" %a', $html);
     $this->assertStringMatchesFormat('%a name="account[lastname]" %s value="Doe" %a', $html);
     $this->assertStringMatchesFormat('%a name="account[email]" %s value="*****@*****.**" %a', $html);
 }
Esempio n. 20
0
 public function __construct(\Ess\M2ePro\Helper\Factory $helperFactory, \Ess\M2ePro\Model\Factory $modelFactory, \Ess\M2ePro\Model\ActiveRecord\Factory $activeRecordFactory, \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory $parentFactory, Renderer\CssRenderer $css, Renderer\JsPhpRenderer $jsPhp, Renderer\JsRenderer $js, Renderer\JsTranslatorRenderer $jsTranslatorRenderer, Renderer\JsUrlRenderer $jsUrlRenderer, \Magento\Framework\App\RequestInterface $request, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Session\Generic $session, \Magento\Framework\Session\SidResolverInterface $sidResolver, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\ConfigInterface $viewConfig, \Magento\Framework\App\Cache\StateInterface $cacheState, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\View\FileSystem $viewFileSystem, \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Page\Config $pageConfig, \Magento\Framework\View\Element\Template\File\Resolver $resolver, \Magento\Framework\View\Element\Template\File\Validator $validator, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, \Magento\Framework\Math\Random $mathRandom, \Magento\Framework\Data\Form\FormKey $formKey, \Magento\Framework\Code\NameBuilder $nameBuilder)
 {
     $this->helperFactory = $helperFactory;
     $this->modelFactory = $modelFactory;
     $this->activeRecordFactory = $activeRecordFactory;
     $this->parentFactory = $parentFactory;
     $this->css = $css;
     $this->jsPhp = $jsPhp;
     $this->js = $js;
     $this->jsTranslator = $jsTranslatorRenderer;
     $this->jsUrl = $jsUrlRenderer;
     parent::__construct($request, $layout, $eventManager, $urlBuilder, $cache, $design, $session, $sidResolver, $scopeConfig, $assetRepo, $viewConfig, $cacheState, $logger, $escaper, $filterManager, $localeDate, $inlineTranslation, $filesystem, $viewFileSystem, $enginePool, $appState, $storeManager, $pageConfig, $resolver, $validator, $authorization, $backendSession, $mathRandom, $formKey, $nameBuilder);
 }
Esempio n. 21
0
 /**
  * @param $customerData
  * @param $isSingleStoreMode
  * @param $canModifyCustomer
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 private function _setupStoreMode($customerData, $isSingleStoreMode, $canModifyCustomer)
 {
     $backendSessionMock = $this->getMock('\\Magento\\Backend\\Model\\Session', ['getCustomerData'], [], '', false);
     $backendSessionMock->expects($this->any())->method('getCustomerData')->will($this->returnValue([]));
     $layoutMock = $this->getMock('\\Magento\\Framework\\View\\Layout\\Element\\Layout', ['createBlock'], [], '', false);
     $layoutMock->expects($this->at(0))->method('createBlock')->with('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Group')->will($this->returnValue($this->objectManagerHelper->getObject('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Group')));
     $layoutMock->expects($this->at(1))->method('createBlock')->with('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element')->will($this->returnValue($this->objectManagerHelper->getObject('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element')));
     if (empty($customerData['id'])) {
         $layoutMock->expects($this->at(2))->method('createBlock')->with('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Sendemail')->will($this->returnValue($this->objectManagerHelper->getObject('Magento\\Customer\\Block\\Adminhtml\\Edit\\Renderer\\Attribute\\Sendemail')));
     }
     $urlBuilderMock = $this->getMock('\\Magento\\Backend\\Model\\Url', ['getBaseUrl'], [], '', false);
     $urlBuilderMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('someUrl'));
     $storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $storeManagerMock->expects($this->any())->method('isSingleStoreMode')->will($this->returnValue($isSingleStoreMode));
     $customerObject = $this->getMock('\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     if (!empty($customerData['id'])) {
         $customerObject->expects($this->any())->method('getId')->will($this->returnValue($customerData['id']));
     }
     $fieldset = $this->getMockBuilder('\\Magento\\Framework\\Data\\Form\\Element\\Fieldset')->setMethods(['getForm', 'addField', 'removeField'])->disableOriginalConstructor()->getMock();
     $accountForm = $this->getMockBuilder('Magento\\Framework\\Data\\Form')->setMethods(['create', 'addFieldset', 'getElement', 'setValues'])->disableOriginalConstructor()->getMock();
     $accountForm->expects($this->any())->method('addFieldset')->with('base_fieldset')->will($this->returnValue($fieldset));
     $accountForm->expects($this->any())->method('setValues')->will($this->returnValue($accountForm));
     $fieldset->expects($this->any())->method('getForm')->will($this->returnValue($accountForm));
     $formElement = $this->getMockBuilder('\\Magento\\Framework\\Data\\Form\\Element\\Select')->setMethods(['setRenderer', 'addClass', 'setDisabled'])->disableOriginalConstructor()->getMock();
     $formElement->expects($this->any())->method('setRenderer')->will($this->returnValue(null));
     $formElement->expects($this->any())->method('addClass')->will($this->returnValue(null));
     $formElement->expects($this->any())->method('setDisabled')->will($this->returnValue(null));
     $accountForm->expects($this->any())->method('getElement')->withAnyParameters()->will($this->returnValue($formElement));
     $fieldset->expects($this->any())->method('addField')->will($this->returnValue($formElement));
     $customerForm = $this->getMock('\\Magento\\Customer\\Model\\Metadata\\Form', ['getAttributes'], [], '', false);
     $customerForm->expects($this->any())->method('getAttributes')->will($this->returnValue([]));
     $this->contextMock->expects($this->any())->method('getBackendSession')->will($this->returnValue($backendSessionMock));
     $this->contextMock->expects($this->any())->method('getLayout')->will($this->returnValue($layoutMock));
     $this->contextMock->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($urlBuilderMock));
     $this->contextMock->expects($this->any())->method('getStoreManager')->will($this->returnValue($storeManagerMock));
     $this->customerFactoryMock->expects($this->any())->method('create')->will($this->returnValue($customerObject));
     $this->dataObjectHelperMock->expects($this->once())->method('populateWithArray');
     $this->options->expects($this->any())->method('getNamePrefixOptions')->will($this->returnValue(['Pref1', 'Pref2']));
     $this->options->expects($this->any())->method('getNameSuffixOptions')->will($this->returnValue(['Suf1', 'Suf2']));
     $this->formFactoryMock->expects($this->any())->method('create')->will($this->returnValue($accountForm));
     $this->extensibleDataObjectConverterMock->expects($this->any())->method('toFlatArray')->will($this->returnValue($customerData));
     $this->customerFormFactoryMock->expects($this->any())->method('create')->with('customer', 'adminhtml_customer', $this->extensibleDataObjectConverterMock->toFlatArray($customerObject, [], '\\Magento\\Customer\\Api\\Data\\CustomerInterface'))->will($this->returnValue($customerForm));
     $this->accountManagementMock->expects($this->any())->method('isReadOnly')->withAnyParameters()->will($this->returnValue(!$canModifyCustomer));
     $this->accountManagementMock->expects($this->any())->method('getConfirmationStatus')->withAnyParameters()->will($this->returnValue(AccountManagementInterface::ACCOUNT_CONFIRMED));
 }
Esempio n. 22
0
 public function setUp()
 {
     $this->modelContext = $this->getMock('Magento\\Framework\\Model\\Context', [], [], '', false);
     $this->registry = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
     $this->extensionFactory = $this->getMock('Magento\\Framework\\Api\\ExtensionAttributesFactory', [], [], '', false);
     $this->customAttributeFactory = $this->getMock('Magento\\Framework\\Api\\AttributeValueFactory', [], [], '', false);
     $this->eavConfig = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->eavTypeFactory = $this->getMock('Magento\\Eav\\Model\\Entity\\TypeFactory', [], [], '', false);
     $this->storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $this->resourceHelper = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Helper', [], [], '', false);
     $this->universalFactory = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->optionDataFactory = $this->getMock('Magento\\Eav\\Api\\Data\\AttributeOptionInterfaceFactory', [], [], '', false);
     $this->dataObjectProcessor = $this->getMock('Magento\\Framework\\Reflection\\DataObjectProcessor', [], [], '', false);
     $this->dataObjectHelper = $this->getMock('Magento\\Framework\\Api\\DataObjectHelper', [], [], '', false);
     $this->localeDate = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\Timezone', [], [], '', false);
     $this->localeDate->expects($this->any())->method('getDateFormat')->will($this->returnValue('12-12-2012'));
     $this->reservedAttributeList = $this->getMock('Magento\\Catalog\\Model\\Product\\ReservedAttributeList', [], [], '', false);
     $this->localeResolver = $this->getMock('Magento\\Framework\\Locale\\Resolver', [], [], '', false);
     $this->resource = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product', [], [], '', false);
     $this->resourceCollection = $this->getMockForAbstractClass('Magento\\Framework\\Data\\Collection\\AbstractDb', [], '', false);
     $this->context = $this->getMock('Magento\\Backend\\Block\\Template\\Context', ['getFileSystem', 'getEscaper', 'getLocaleDate', 'getLayout'], [], '', false);
     $filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->context->expects($this->any())->method('getFileSystem')->will($this->returnValue($filesystem));
     $escaper = $this->getMock('Magento\\Framework\\Escaper', ['escapeHtml'], [], '', false);
     $escaper->expects($this->any())->method('escapeHtml')->will($this->returnValue(''));
     $this->context->expects($this->any())->method('getEscaper')->will($this->returnValue($escaper));
     $timeZone = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimeZone', [], [], '', false);
     $timeZone->expects($this->any())->method('getDateFormat')->will($this->returnValue('M/d/yy'));
     $this->context->expects($this->any())->method('getLocaleDate')->will($this->returnValue($timeZone));
     $dateBlock = $this->getMock('Magento\\Framework\\View\\Element\\Html\\Date', ['setValue', 'getHtml', 'setId', 'getId'], [], '', false);
     $dateBlock->expects($this->any())->method('setValue')->will($this->returnSelf());
     $dateBlock->expects($this->any())->method('getHtml')->will($this->returnValue(''));
     $dateBlock->expects($this->any())->method('setId')->will($this->returnSelf());
     $dateBlock->expects($this->any())->method('getId')->will($this->returnValue(1));
     $layout = $this->getMock('Magento\\Framework\\View\\Layout', [], [], '', false);
     $layout->expects($this->any())->method('createBlock')->will($this->returnValue($dateBlock));
     $this->context->expects($this->any())->method('getLayout')->will($this->returnValue($layout));
     $this->backendHelper = $this->getMock('Magento\\Backend\\Helper\\Data', [], [], '', false);
     $this->importExportData = $this->getMock('Magento\\ImportExport\\Helper\\Data', [], [], '', false);
     $this->dateTimeFormatter = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateTimeFormatterInterface');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->filter = $this->objectManagerHelper->getObject('Magento\\ImportExport\\Block\\Adminhtml\\Export\\Filter', ['context' => $this->context, 'backendHelper' => $this->backendHelper, 'importExportData' => $this->importExportData]);
 }
Esempio n. 23
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
 {
     $this->_urlBuilder = $context->getUrlBuilder();
     parent::__construct($context, $data);
 }
Esempio n. 24
0
 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @param \Magento\Framework\View\LayoutInterface $layout
  * @param \Magento\Framework\Event\ManagerInterface $eventManager
  * @param \Magento\Framework\UrlInterface $urlBuilder
  * @param \Magento\Framework\TranslateInterface $translator
  * @param \Magento\Framework\App\CacheInterface $cache
  * @param \Magento\Framework\View\DesignInterface $design
  * @param \Magento\Framework\Session\Generic $session
  * @param \Magento\Framework\Session\SidResolverInterface $sidResolver
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\View\ConfigInterface $viewConfig
  * @param \Magento\Framework\App\Cache\StateInterface $cacheState
  * @param \Magento\Framework\Logger $logger
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Framework\Filter\FilterManager $filterManager
  * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
  * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
  * @param \Magento\Framework\App\Filesystem $filesystem
  * @param \Magento\Framework\View\FileSystem $viewFileSystem
  * @param \Magento\Framework\View\TemplateEnginePool $enginePool
  * @param \Magento\Framework\App\State $appState
  * @param \Magento\Framework\StoreManagerInterface $storeManager
  * @param \Magento\Framework\AuthorizationInterface $authorization
  * @param \Magento\Backend\Model\Session $backendSession
  * @param \Magento\Framework\Math\Random $mathRandom
  * @param \Magento\Framework\Data\Form\FormKey $formKey
  * @param \Magento\Framework\Code\NameBuilder $nameBuilder
  * @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList
  * @param Button\ToolbarInterface $toolbar
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\App\RequestInterface $request, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\TranslateInterface $translator, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Session\Generic $session, \Magento\Framework\Session\SidResolverInterface $sidResolver, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\ConfigInterface $viewConfig, \Magento\Framework\App\Cache\StateInterface $cacheState, \Magento\Framework\Logger $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\App\Filesystem $filesystem, \Magento\Framework\View\FileSystem $viewFileSystem, \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, \Magento\Framework\Math\Random $mathRandom, \Magento\Framework\Data\Form\FormKey $formKey, \Magento\Framework\Code\NameBuilder $nameBuilder, Button\ButtonList $buttonList, Button\ToolbarInterface $toolbar)
 {
     parent::__construct($request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, $sidResolver, $scopeConfig, $assetRepo, $viewConfig, $cacheState, $logger, $escaper, $filterManager, $localeDate, $inlineTranslation, $filesystem, $viewFileSystem, $enginePool, $appState, $storeManager, $authorization, $backendSession, $mathRandom, $formKey, $nameBuilder);
     $this->buttonList = $buttonList;
     $this->buttonToolbar = $toolbar;
 }
Esempio n. 25
0
 public function __construct(\ShipperHQ\Shipper\Helper\Data $shipperDataHelper, \Magento\Backend\Block\Template\Context $context, \Magento\Shipping\Model\Config $shippingConfig)
 {
     $this->shippingConfig = $shippingConfig;
     $this->storeManager = $context->getStoreManager();
     $this->shipperDataHelper = $shipperDataHelper;
 }
Esempio n. 26
0
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, StoreManager $storeManager)
 {
     $this->storeManager = $storeManager;
     $this->_configResource = $context->getScopeConfig();
     parent::__construct($context);
 }
 protected function initContext()
 {
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
     $this->context = $this->getMockBuilder('Magento\\Backend\\Block\\Template\\Context')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->any())->method('getRequest')->willReturn($this->request);
 }
Esempio n. 28
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = array())
 {
     $this->_storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
 }
Esempio n. 29
0
 /**
  * Grid constructor.
  *
  * @param Context           $context
  * @param BackendHelper     $backendHelper
  * @param CollectionFactory $collectionFactory
  */
 public function __construct(Context $context, BackendHelper $backendHelper, CollectionFactory $collectionFactory)
 {
     $this->collectionFactory = $collectionFactory;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $backendHelper);
 }
Esempio n. 30
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Backend\Helper\Data $backendHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, array $data = [])
 {
     $this->_backendHelper = $backendHelper;
     $this->_backendSession = $context->getBackendSession();
     parent::__construct($context, $data);
 }