function setUp() { parent::setUp(); $_GET = []; $_POST = []; $this->expected_redirects = []; }
public function setUp() { parent::setUp(); Factory::create('migration', ['version' => '20140319-old_migration']); $this->service = $this->getMockBuilder('MigrationsService')->setMethods(['scan_migrations_dir', 'run_query', 'get_migration_contents'])->disableOriginalConstructor()->getMock(); $this->service->expects($this->once())->method('scan_migrations_dir')->will($this->returnValue(['20140319-old_migration.sql', '20140319-new_migration.sql'])); $this->service->initialize(); }
/** * Get the PDO database connection. * @return PDO A PDO database connection. */ public static final function getPDO() { // Create a new PDO database connection if it has not yet existed if (self::$pdo == null) { $options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING); self::$pdo = new PDO('mysql:host=localhost:3306;dbname=plannpla_test', 'plannpla_webapp', 'pnp428', $options); } return self::$pdo; }
/** * Reset test database with a fresh test dataset. */ public function resetDatabase() { parent::setUp(); }
/** * Used for framework tests development */ public function doExecInitFrameworkDOs() { $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options['database'] = DB_URI_TEST; $options['class_location'] = PEAR_FOLDER . 'M/tests/DO/'; $options['schema_location'] = PEAR_FOLDER . 'M/tests/DO/'; ini_set('display_errors', 1); if (!defined('SIMPLE_TEST')) { define('SIMPLE_TEST', 'simpletest/'); } require_once SIMPLE_TEST . 'unit_tester.php'; require_once TESTS_FOLDER . '/extensions/DBTestCase.php'; $t = new DBTestCase(); $t->setUpDatabase('Mfixture.sql', 1); require_once 'M/DB/DataObject/Advgenerator.php'; $generator = new DB_DataObject_Advgenerator(); $generator->start(); $this->redirect(array('module' => 'unittests'), array(), array_keys($_REQUEST)); }