mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-10-03 09:49:14 +02:00
renaming controller #342
This commit is contained in:
parent
90e83ddb30
commit
f9c8441edb
10 changed files with 74 additions and 74 deletions
41
tst/ControllerWithDbTest.php
Normal file
41
tst/ControllerWithDbTest.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use PrivateBin\Data\Database;
|
||||
|
||||
require_once 'ControllerTest.php';
|
||||
|
||||
class ControllerWithDbTest extends ControllerTest
|
||||
{
|
||||
private $_options = array(
|
||||
'usr' => null,
|
||||
'pwd' => null,
|
||||
'opt' => array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_PERSISTENT => true,
|
||||
),
|
||||
);
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
|
||||
if (!is_dir($this->_path)) {
|
||||
mkdir($this->_path);
|
||||
}
|
||||
$this->_options['dsn'] = 'sqlite:' . $this->_path . DIRECTORY_SEPARATOR . 'tst.sq3';
|
||||
$this->_model = Database::getInstance($this->_options);
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
parent::reset();
|
||||
// but then inject a db config
|
||||
$options = parse_ini_file(CONF, true);
|
||||
$options['model'] = array(
|
||||
'class' => 'Database',
|
||||
);
|
||||
$options['model_options'] = $this->_options;
|
||||
Helper::createIniFile(CONF, $options);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue