PrivateBin/tst/privatebinWithDb.php

44 lines
1.0 KiB
PHP
Raw Normal View History

<?php
2016-07-11 05:58:15 -04:00
require_once 'privatebin.php';
2016-07-11 05:58:15 -04:00
class privatebinWithDbTest extends privatebinTest
{
private $_options = array(
'dsn' => 'sqlite:../data/tst.sq3',
'usr' => null,
'pwd' => null,
'opt' => array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_PERSISTENT => true
),
);
public function setUp()
{
/* Setup Routine */
2016-07-11 05:58:15 -04:00
$this->_model = privatebin_db::getInstance($this->_options);
serversalt::setPath(PATH . 'data');
$this->reset();
}
public function tearDown()
{
/* Tear Down Routine */
parent::tearDown();
@unlink('../data/tst.sq3');
}
public function reset()
{
parent::reset();
// but then inject a db config
$options = parse_ini_file(CONF, true);
$options['model'] = array(
2016-07-11 05:58:15 -04:00
'class' => 'privatebin_db',
);
$options['model_options'] = $this->_options;
helper::confBackup();
helper::createIniFile(CONF, $options);
}
2016-07-11 08:15:20 -04:00
}