mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 20:27:07 +09:00
* Remove manual unsetting of `BOXADMR` cookie * Rename locale cookie `BBLANG` to `fb_locale` * Rename session name to `fb_sid` * Tidy comments in `config-sample.php` * Remove legacy `bb-ipn.php` rewrite rule * Remove legacy BB params and file migration check * Remove header comments from `robots.txt` * Update SQL dump header database name * Use `FB_*` DB constants and add DB port
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
abstract class BBDatabaseTestCase extends TestCase
|
|
{
|
|
private static ?PDO $pdo = null;
|
|
private $conn;
|
|
|
|
protected $_seedFilesPath;
|
|
protected $_initialSeedFile = 'initial.xml';
|
|
|
|
final public function getConnection()
|
|
{
|
|
if ($this->conn === null) {
|
|
if (self::$pdo == null) {
|
|
self::$pdo = new PDO('mysql:dbname=' . FB_DB_NAME . ';host=127.0.0.1;port=' . FB_DB_PORT, FB_DB_USER, FB_DB_PASSWORD);
|
|
}
|
|
$this->conn = $this->createDefaultDBConnection(self::$pdo, FB_DB_NAME);
|
|
}
|
|
|
|
return $this->conn;
|
|
}
|
|
|
|
/**
|
|
* Returns the seed files folder path.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getSeedFilesPath()
|
|
{
|
|
if ($this->_seedFilesPath == null) {
|
|
$this->_seedFilesPath = PATH_TESTS . '/fixtures';
|
|
}
|
|
|
|
return rtrim((string) $this->_seedFilesPath, '/') . '/';
|
|
}
|
|
|
|
/**
|
|
* Retrieve from flat XML files data used to populate the database.
|
|
*
|
|
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
|
|
*/
|
|
protected function getDataSet()
|
|
{
|
|
return $this->createFlatXmlDataSet($this->getSeedFilesPath() . $this->_initialSeedFile);
|
|
}
|
|
}
|