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; }
/** * Make a database dump and return an object on which you can call `restore` to restore the dump. */ public static function create() { $dump = new DatabaseDump(); $dump->dump(); return $dump; }