Author: Mike Lively (m@digitalsandwich.com)
Inheritance: extends PHPUnit_Framework_TestCase
 protected function tearDown()
 {
     parent::tearDown();
     $this->conn->close();
     $this->conn = null;
     self::$pdo = null;
 }
Example #2
0
 protected function setUp()
 {
     parent::setUp();
     if ($this->__debug) {
         echo __METHOD__ . "\n";
     }
 }
Example #3
0
 /**
  * @covers bankaccount\mapper\BankAccount::__construct
  */
 protected function setUp()
 {
     $this->db = new \PDO('sqlite::memory:');
     $this->mapper = new BankAccountMapper($this->db);
     $this->db->exec(file_get_contents(__DIR__ . '/../../../../database/bankaccount.sql'));
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     $container = getContainer();
     self::$databaseDumper = $container->get('dumper.database.mysql');
     self::$shellExecutor = $container->get('helper.shell_executor');
 }
 public function setUp()
 {
     parent::setUp();
     // DbEntityHelper::truncateDatabase(self::$propelCon);
     \Tbmt\SystemSetup::setCon(self::$propelCon);
     \Tbmt\SystemSetup::doSetupUnitTests();
 }
 protected function setUp()
 {
     if (!extension_loaded('pdo_sqlite')) {
         $this->markTestSkipped('PDO/SQLite is required to run this test.');
     }
     parent::setUp();
 }
 protected function setUp()
 {
     if (defined('DB_NOT_AVAILABLE')) {
         $this->markTestSkipped();
     }
     parent::setUp();
 }
 public function setup()
 {
     parent::setUp();
     // Establish a local reference to the Slim app object
     $this->app = $this->getSlimInstance();
     $this->client = new WebTestClient($this->app);
 }
 public function setUp()
 {
     $this->pdo = new \PDO('sqlite::memory:');
     $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     $this->pdo->prepare("CREATE TABLE IF NOT EXISTS 'guestbook' (id int, content text, user text, created datetime)")->execute();
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     $conn = $this->getConnection()->getConnection();
     $conn->exec("drop database lib_migration_test;");
     $conn->exec("create database lib_migration_test;");
 }
 /**
  * Filling the config object with individual testcase data.
  */
 protected function setUp()
 {
     $dbFactory = new Factory();
     if (!isset($this->db)) {
         Registry::remove('db');
         $config = $this->getConfig();
         $this->db = $dbFactory->getInstanceByConfig($config);
         Registry::set('db', $this->db);
     }
     if ($this->db === false) {
         $this->markTestIncomplete('Necessary DB configuration is not set.');
         parent::setUp();
         return;
     }
     /*
      * Deleting all tables from the db and setting up the db using the given schema.
      */
     $sql = 'SHOW TABLES';
     $tableList = $this->db->queryList($sql);
     foreach ($tableList as $table) {
         $sql = 'DROP TABLE ' . $table;
         $this->db->query($sql);
     }
     $this->db->queryMulti($this->getSchemaSQLQueries());
     parent::setUp();
 }
Example #12
0
 protected function setUp()
 {
     parent::setUp();
     if ($this->isUsingSqlite()) {
         $this->resetSqliteAutoincrement();
     }
 }
Example #13
0
 /**
  * Set up tables
  */
 public static function setUpBeforeClass()
 {
     foreach (static::$_tables as $table) {
         \Library\Application::getService("Database\\Table\\{$table}")->setSchema();
     }
     parent::setUpBeforeClass();
 }
Example #14
0
 public static function setUpBeforeClass()
 {
     foreach (static::$_tables as $table) {
         static::$serviceManager->get("Database\\Table\\{$table}")->setSchema(true);
     }
     parent::setUpBeforeClass();
 }
Example #15
0
 protected function setUp()
 {
     parent::setUp();
     if (is_null($this->app)) {
         $this->app = $this->getApplication();
     }
 }
 public function setUp()
 {
     // init test table - table is altered during tests - must be recreated before each test run
     Helpers::loadFromFile($this->getConnection()->getConnection(), __DIR__ . '/_data/csv-import/init.sql');
     parent::setUp();
     $this->import = new CsvImportMysql($this->getConnection()->getConnection());
 }
 public function setUp()
 {
     $this->_table = $this->getMockBuilder('Database\\AbstractTable')->disableOriginalConstructor()->getMockForAbstractClass();
     $adapter = new \ReflectionProperty('Database\\AbstractTable', 'adapter');
     $adapter->setAccessible(true);
     $adapter->setValue($this->_table, \Library\Application::getService('Db'));
     return parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     $this->_redis = $this->getMockBuilder('Redis')->disableOriginalConstructor()->setMethods(array('get', 'set'))->getMock();
     $this->_redis->method('get')->willReturn(false);
     $date = "2016-01-21 01:02:03";
     $this->_featuredFlags = new FeaturedFlagsImpl(self::$pdo, $this->_redis, $date);
 }
 protected function tearDown()
 {
     for ($i = 1; $i < self::$connPointer; $i++) {
         unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test' . $i . '.sqlite');
     }
     self::$connPointer = 0;
     parent::tearDown();
 }
Example #20
0
 protected function setUp()
 {
     parent::setUp();
     error_reporting(E_ALL ^ E_NOTICE);
     Cache::init('volatile');
     $_SESSION["user_id"] = "1";
     Application::$config['log_level'] = 550;
 }
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     if (Yii::$app->get('db', false) === null) {
         $this->markTestSkipped();
     } else {
         parent::setUp();
     }
 }
Example #22
0
 /**
  * Setup database.
  */
 protected function setUp()
 {
     Bootstrap::getServiceManager();
     $conn = $this->getConnection();
     $conn->getConnection()->query("set foreign_key_checks=0");
     parent::setUp();
     $conn->getConnection()->query("set foreign_key_checks=1");
 }
Example #23
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     \ntentan\caching\Cache::reset();
     $this->users = \ntentan\models\Model::load('users');
     $this->roles = \ntentan\models\Model::load('roles');
     $this->departments = \ntentan\models\Model::load('departments');
 }
Example #24
0
 protected function setUp()
 {
     parent::setUp();
     $params['pdo'] = $this->pdo;
     $db = DriverManager::getConnection($params);
     $this->query = 'SELECT * FROM posts';
     $this->pager = new Pager($db, new Pagerfanta(new DoctrineDbalAdapter($db, $this->query)));
 }
 public static function setUpBeforeClass()
 {
     /*
      * Configure the library with the DB connection
      */
     //        Config::setConnection(self::getPDO());
     parent::setUpBeforeClass();
 }
Example #26
0
 public function setUp()
 {
     parent::setUp();
     $dbOptions = new ThrottleDbAdapterOptions();
     $this->gateway = new TableGateway($dbOptions->getDbTable(), $this->getAdapter());
     $this->throttleDbAdapter = new ThrottleDbAdapter($this->gateway, $dbOptions, new LockHandleFactory());
     $this->throttle = new Throttle($this->throttleDbAdapter, new ThrottleOptions());
 }
Example #27
0
 protected function setUp()
 {
     parent::setUp();
     $params['pdo'] = $this->pdo;
     $db = DriverManager::getConnection($params);
     $this->sql = 'SELECT * FROM posts';
     $this->pager = new PagingQuery($db, $this->sql);
 }
Example #28
0
 protected function setUp()
 {
     \Bh\Lib\Mapper::getEntityManager()->clear();
     $this->getConnection();
     $this->setForeignKeyChecks(false);
     parent::setUp();
     $this->setForeignKeyChecks(true);
 }
 protected function setUp()
 {
     parent::setUp();
     $params['pdo'] = $this->pdo;
     $db = DriverManager::getConnection($params);
     $this->sql = 'SELECT * FROM posts';
     $this->adapter = new DoctrineDbalAdapter($db, $this->sql);
 }
Example #30
0
 public function setUp()
 {
     parent::setUp();
     $dbOptions = new UnionDbAdapterOptions();
     $this->gateway = new TableGateway($dbOptions->getDbTable(), $this->getAdapter());
     $this->unionAdapter = new UnionDbAdapter($this->gateway, $dbOptions);
     $unionOptions = new UnionOptions();
     $this->union = new Union($this->unionAdapter, $unionOptions);
 }