public function initialize() { parent::initialize(); $db = Db::connection(); $db->tableExists($this->_table) or $this->createTable(); $db->delete($this->_table); }
public function __construct($options) { $this->options = $options; $this->table = $options['table']; $this->db = Db::connection($options['connection']); $this->db->tableExists($this->table) or $this->createTable(); Config::runningUnitTest() and $this->db->delete($this->table); }
public function setUp() { parent::setUp(); Config::set('counter.default', 'rds'); Counter::register($this->di); $db = Db::connection(); $db->tableExists('counter') and $db->dropTable('counter'); }
protected static function createConfigTable() { $db = Db::connection(); $db->createTable('config', null, ['columns' => [new Column('key', ['type' => Column::TYPE_VARCHAR, 'size' => 32, 'notNull' => true, 'primary' => true]), new Column('value', ['type' => Column::TYPE_TEXT])]]); if (PhwoolconConfig::runningUnitTest()) { static::saveConfig('_testing', ['k' => 'v']); } }
public function reset($keyName) { $db = Db::connection(); $db->updateAsDict($this->table, ['value' => 0], ['conditions' => $this->updateCondition, 'bind' => [$keyName]]); }
public function execute(InputInterface $input, OutputInterface $output) { $this->db = Db::connection(); parent::execute($input, $output); }
public function testConnection() { $this->assertEquals('value', Db::connection()->query('SELECT "value" v')->fetch()['v'], 'Unable to connect DB'); }