Introduce PSR-4 autoloading

This commit is contained in:
Sobak
2016-07-21 17:09:48 +02:00
parent 62dafbe8dd
commit 54f96b9938
48 changed files with 342 additions and 238 deletions

View File

@@ -1,4 +1,7 @@
<?php
use PrivateBin\data\data;
class privatebin_dataTest extends PHPUnit_Framework_TestCase
{
private $_model;
@@ -9,7 +12,7 @@ class privatebin_dataTest extends PHPUnit_Framework_TestCase
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = privatebin_data::getInstance(array('dir' => $this->_path));
$this->_model = data::getInstance(array('dir' => $this->_path));
}
public function tearDown()

View File

@@ -1,4 +1,7 @@
<?php
use PrivateBin\data\db;
class privatebin_dbTest extends PHPUnit_Framework_TestCase
{
private $_model;
@@ -13,7 +16,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
public function setUp()
{
/* Setup Routine */
$this->_model = privatebin_db::getInstance($this->_options);
$this->_model = db::getInstance($this->_options);
}
public function tearDown()
@@ -110,7 +113,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetIbmInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -121,7 +124,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetInformixInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -132,7 +135,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetMssqlInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -143,7 +146,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetMysqlInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -154,7 +157,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetOciInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -165,7 +168,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetPgsqlInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
));
@@ -177,7 +180,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
*/
public function testGetFooInstance()
{
privatebin_db::getInstance(array(
db::getInstance(array(
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null
));
}
@@ -190,7 +193,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
{
$options = $this->_options;
unset($options['dsn']);
privatebin_db::getInstance($options);
db::getInstance($options);
}
/**
@@ -201,7 +204,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
{
$options = $this->_options;
unset($options['usr']);
privatebin_db::getInstance($options);
db::getInstance($options);
}
/**
@@ -212,7 +215,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
{
$options = $this->_options;
unset($options['pwd']);
privatebin_db::getInstance($options);
db::getInstance($options);
}
/**
@@ -223,7 +226,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
{
$options = $this->_options;
unset($options['opt']);
privatebin_db::getInstance($options);
db::getInstance($options);
}
public function testOldAttachments()
@@ -233,7 +236,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
@unlink($path);
$this->_options['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'bar_';
$model = privatebin_db::getInstance($this->_options);
$model = db::getInstance($this->_options);
$original = $paste = helper::getPasteWithAttachment(array('expire_date' => 1344803344));
$paste['meta']['attachment'] = $paste['attachment'];
@@ -301,7 +304,7 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
'vizhash BLOB, ' .
"postdate INT );"
);
privatebin_db::getInstance($this->_options);
db::getInstance($this->_options);
helper::rmdir(PATH . 'data');
}
}