Files
FOSSBilling/tests-legacy/includes/BBDatabaseTestCase.php
T
Adam Daley 96659a195c Refactor cookie management and clean up legacy (#3308)
* 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
2026-03-10 08:42:11 +00:00

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);
}
}