These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once 'privatebin.php'; |
||
3 | |||
4 | class privatebinWithDbTest extends privatebinTest |
||
5 | { |
||
6 | private $_options = array( |
||
7 | 'dsn' => 'sqlite:../data/tst.sq3', |
||
8 | 'usr' => null, |
||
9 | 'pwd' => null, |
||
10 | 'opt' => array( |
||
11 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
||
12 | PDO::ATTR_PERSISTENT => true |
||
13 | ), |
||
14 | ); |
||
15 | |||
16 | public function setUp() |
||
17 | { |
||
18 | /* Setup Routine */ |
||
19 | $this->_model = privatebin_db::getInstance($this->_options); |
||
20 | serversalt::setPath(PATH . 'data'); |
||
21 | $this->reset(); |
||
22 | } |
||
23 | |||
24 | public function tearDown() |
||
25 | { |
||
26 | /* Tear Down Routine */ |
||
27 | parent::tearDown(); |
||
28 | @unlink('../data/tst.sq3'); |
||
0 ignored issues
–
show
|
|||
29 | } |
||
30 | |||
31 | public function reset() |
||
32 | { |
||
33 | parent::reset(); |
||
34 | // but then inject a db config |
||
35 | $options = parse_ini_file(CONF, true); |
||
36 | $options['model'] = array( |
||
37 | 'class' => 'privatebin_db', |
||
38 | ); |
||
39 | $options['model_options'] = $this->_options; |
||
40 | helper::confBackup(); |
||
41 | helper::createIniFile(CONF, $options); |
||
42 | } |
||
43 | } |
||
44 |
If you suppress an error, we recommend checking for the error condition explicitly: