Ejemplo n.º 1
0
 public function setup()
 {
     parent::setup();
     $this->settings = new ProductPresentationSettings();
     $this->settings->catalog_mode = false;
     $this->settings->restricted_country_mode = false;
     $this->settings->showPrices = true;
     $this->product = [];
     $this->product['available_for_order'] = true;
     $this->product['id_product'] = 1;
     $this->product['id_product_attribute'] = 0;
     $this->product['link_rewrite'] = 'hérisson';
     $this->product['price'] = null;
     $this->product['price_tax_exc'] = null;
     $this->product['specific_prices'] = null;
     $this->product['customizable'] = false;
     $this->product['quantity'] = 1;
     $this->product['allow_oosp'] = false;
     $this->product['online_only'] = false;
     $this->product['reduction'] = false;
     $this->product['on_sale'] = false;
     $this->product['new'] = false;
     $this->product['pack'] = false;
     $this->product['show_price'] = true;
     $this->language = new Language();
 }
Ejemplo n.º 2
0
 public function setup()
 {
     parent::setup();
     $this->productPriceCalculator = new FakeProductPriceCalculator();
     $this->container->bind('\\PrestaShop\\PrestaShop\\Adapter\\Product\\PriceCalculator', $this->productPriceCalculator);
     $addressFactory = Phake::mock('\\PrestaShop\\PrestaShop\\Adapter\\AddressFactory');
     $address = new Address();
     $address->id = 1;
     Phake::when($addressFactory)->findOrCreate()->thenReturn($address);
     $this->container->bind('\\PrestaShop\\PrestaShop\\Adapter\\AddressFactory', $addressFactory);
     $this->cart = new Cart();
     $this->cart->id = 1;
 }
Ejemplo n.º 3
0
 public function setup()
 {
     parent::setup();
     $context = new Context();
     $context->language = new Language();
     $context->customer = new Customer();
     $context->link = Phake::mock('Link');
     Phake::when($context->link)->getPageLink(Phake::anyParameters())->thenReturn('http://addresses-actions.url');
     $smarty = Phake::mock('Smarty');
     $translator = Phake::mock('Symfony\\Component\\Translation\\TranslatorInterface');
     $addressForm = Phake::mock('CustomerAddressForm');
     $this->session = Phake::mock('CheckoutSession');
     Phake::when($this->session)->getCustomer()->thenReturn($context->customer);
     $process = new CheckoutProcess($context, $this->session);
     $this->step = new CheckoutAddressesStep($context, $translator, $addressForm);
     $this->step->setCheckoutProcess($process);
 }
 public function setUp()
 {
     parent::setup();
     $this->languageISOCode = 'en';
     $this->legacyContext = Phake::partialMock('PrestaShop\\PrestaShop\\Adapter\\LegacyContext');
     Phake::when($this->legacyContext)->getAdminBaseUrl()->thenReturn('admin_fake_base');
     if (!isset($_SERVER['HTTP_HOST'])) {
         $this->httpHostNotFound = true;
         $_SERVER['HTTP_HOST'] = 'localhost';
     }
     $this->setupSfKernel();
     $this->sfRouter = $this->sfKernel->getContainer()->get('router');
     $this->addonsDataProviderS = $this->getMockBuilder('PrestaShop\\PrestaShop\\Adapter\\Addons\\AddonsDataProvider')->disableOriginalConstructor()->getMock();
     $this->categoriesProviderS = $this->getMockBuilder('PrestaShopBundle\\Service\\DataProvider\\Admin\\CategoriesProvider')->disableOriginalConstructor()->getmock();
     /* The module catalog will contains only 5 modules for theses tests */
     $fakeModules = array($this->fakeModule(1, 'pm_advancedpack', 'Advanced Pack 5 - Create ​​bundles of products', 'Cross-selling & Product Bundles', 'Allows the sale batch using any stocks actually available products composing your packs, and offers the opportunity to apply business operations'), $this->fakeModule(2, 'cmcicpaiement', 'CM-CIC / Monetico Payment in one instalment', 'Payment by Card or Wallet', 'Accept bank card payments in your online shop with the CM-CIC / Monetico p@yment module!  This very popular means of secure payment reassures your customers when they make their purchases in your'), $this->fakeModule(3, 'bitcoinpayment', 'Coinbase Payment (Bitcoin)', 'Other Payment Methods', 'Use the Coinbase payment module to give your customers the possibility of paying for their purchases in your store with Bitcoin!  This module uses the API from Coinbase, a globally recognized Bitcoin'), $this->fakeModule(4, 'fake_module', 'Fake module 1', 'PHPUnit Fakes', ''), $this->fakeModule(5, 'fake_module_2', 'Fake module 2', 'PHPUnit Fakes', ''));
     /* we need to fake cache wih fake catalog */
     $this->clearModuleCache();
     file_put_contents(_PS_CACHE_DIR_ . 'en_addons_modules.json', json_encode($fakeModules, true));
     $this->adminModuleDataProvider = new AdminModuleDataProvider($this->languageISOCode, $this->sfRouter, $this->addonsDataProviderS, $this->categoriesProviderS);
 }
Ejemplo n.º 5
0
 public function setup()
 {
     $this->hookRepository = Phake::mock('PrestaShop\\PrestaShop\\Core\\Module\\HookRepository');
     $this->hookConfigurator = new HookConfigurator($this->hookRepository);
     parent::setup();
 }