public static function setUpBeforeClass() { if (getenv('APPVEYOR')) { self::$config['password'] = '******'; } $sql = file_get_contents(\Codeception\Configuration::dataDir() . '/dumps/mysql.sql'); $sql = preg_replace('%/\\*(?:(?!\\*/).)*\\*/%s', "", $sql); self::$sql = explode("\n", $sql); try { self::$mysql = Db::create(self::$config['dsn'], self::$config['user'], self::$config['password']); self::$mysql->cleanup(); } catch (\Exception $e) { } }
protected function setUp() { parent::setUp(); $config = new Config(__DIR__ . '/ini/mysql_test.ini'); $logurl = parse_url($config->get('logurl', '')); $this->logfile = $logurl['path']; Mysql::removeAllNames(); self::$mysql = new Mysql(__DIR__ . '/ini/mysql.ini'); self::$mysql->query('DROP TABLE IF EXISTS only_for_test'); self::$mysql->query('CREATE TABLE `only_for_test` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `content` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8'); @unlink($this->logfile); }