public function setup() { parent::setup(); $context = Context::getContext(); $this->link = $context->link; $this->language = $context->language; }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); Module::updateTranslationsAfterInstall(false); Context::getContext()->employee = new Employee(); Context::getContext()->employee->id = 1; Context::getContext()->employee->id_profile = _PS_ADMIN_PROFILE_; }
protected function setUp() { parent::setUp(); \ContextCore::getContext()->employee = new \Employee(1); $this->moduleManagerBuilder = ModuleManagerBuilder::getInstance(); $this->moduleManager = $this->moduleManagerBuilder->build(); $this->moduleNames = ['pscsx3241', 'pscsx32412']; }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // Save the database to restore it later: we're not the only test running so let's leave things // the way we found them. self::$dump = DatabaseDump::create(); // Some tests might have cleared the configuration Configuration::loadConfiguration(); // Context needs a currency but doesn't set it by itself, use default one. Context::getContext()->currency = new Currency(self::getCurrencyId()); // We'll base all our computations on the invoice address Configuration::updateValue('PS_TAX_ADDRESS_TYPE', 'id_address_invoice'); // We don't care about stock, abstract this away by allowing ordering out of stock products Configuration::updateValue('PS_ORDER_OUT_OF_STOCK', true); // Create the address only once self::$id_address = self::makeAddress()->id; }
public static function setupBeforeClass() { parent::setUpBeforeClass(); if (!file_exists(_PS_MODULE_DIR_ . '/prestafraud/prestafraud.php')) { $download = file_put_contents(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip', Tools::addonsRequest('module', array('id_module' => 4181))); Assert::assertGreaterThan(20000, $download, 'Fail download module from Addons'); $extract = Tools::ZipExtract(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip', _PS_MODULE_DIR_); Assert::assertTrue($extract, 'Fail extract module'); unlink(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip'); } self::$prestafraud = Module::getInstanceByName('prestafraud'); Assert::assertTrue(is_object(self::$prestafraud), 'Fail Module::getInstanceByName(\'prestafraud\')'); Assert::assertEquals('prestafraud', self::$prestafraud->name); if (!Module::isInstalled('prestafraud')) { Assert::assertTrue((bool) self::$prestafraud->install()); } Assert::assertTrue((bool) self::$prestafraud->isRegisteredInHook('actionValidateOrder'), 'Fail Module::isRegisteredInHook(\'actionValidateOrder\')'); $uniqid = uniqid() . time(); $email = 'prestabot+' . $uniqid . '@gmail.com'; $shop_url = 'http://www.prestashop-unit-test-' . $uniqid . '.com/'; $result = self::$prestafraud->_createAccount($email, $shop_url); Assert::assertTrue($result, implode(', ', self::$prestafraud->_errors)); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); \PrestaShop\PrestaShop\Tests\Helper\Module::addModule('pscsx3241'); \PrestaShop\PrestaShop\Tests\Helper\Module::addModule('pscsx32412'); }
public static function setupBeforeClass() { parent::setUpBeforeClass(); }