mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Make database connections for testing configurable
This commit is contained in:
parent
2628ff7bf4
commit
cb71a9efd7
3 changed files with 29 additions and 10 deletions
|
@ -68,7 +68,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
/** @dataProvider provideBinaryBindings */
|
||||
public function testHandleBinaryData($value, string $type, string $exp) {
|
||||
if (in_array(static::$implementation, ["PostgreSQL", "PDO PostgreSQL"])) {
|
||||
$this->markTestSkipped("Correct handling of binary data with PostgreSQL and native MySQL is currently unknown");
|
||||
$this->markTestIncomplete("Correct handling of binary data with PostgreSQL is not currently implemented");
|
||||
}
|
||||
if ($exp === "null") {
|
||||
$query = "SELECT (? is null) as pass";
|
||||
|
|
|
@ -43,15 +43,19 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
|||
|
||||
public static function setConf(array $conf = [], bool $force = true) {
|
||||
$defaults = [
|
||||
'dbSQLite3File' => ":memory:",
|
||||
'dbSQLite3Timeout' => 0,
|
||||
'dbPostgreSQLUser' => "arsse_test",
|
||||
'dbPostgreSQLPass' => "arsse_test",
|
||||
'dbPostgreSQLDb' => "arsse_test",
|
||||
'dbPostgreSQLSchema' => "arsse_test",
|
||||
'dbMySQLUser' => "arsse_test",
|
||||
'dbMySQLPass' => "arsse_test",
|
||||
'dbMySQLDb' => "arsse_test",
|
||||
'dbSQLite3File' => ":memory:",
|
||||
'dbSQLite3Timeout' => 0,
|
||||
'dbPostgreSQLHost' => $_ENV['ARSSE_TEST_PGSQL_HOST'] ?: "",
|
||||
'dbPostgreSQLPort' => $_ENV['ARSSE_TEST_PGSQL_PORT'] ?: 5432,
|
||||
'dbPostgreSQLUser' => $_ENV['ARSSE_TEST_PGSQL_USER'] ?: "arsse_test",
|
||||
'dbPostgreSQLPass' => $_ENV['ARSSE_TEST_PGSQL_PASS'] ?: "arsse_test",
|
||||
'dbPostgreSQLDb' => $_ENV['ARSSE_TEST_PGSQL_DB'] ?: "arsse_test",
|
||||
'dbPostgreSQLSchema' => $_ENV['ARSSE_TEST_PGSQL_SCHEMA'] ?: "arsse_test",
|
||||
'dbMySQLHost' => $_ENV['ARSSE_TEST_MYSQL_HOST'] ?: "localhost",
|
||||
'dbMySQLPort' => $_ENV['ARSSE_TEST_MYSQL_PORT'] ?: 3306,
|
||||
'dbMySQLUser' => $_ENV['ARSSE_TEST_MYSQL_USER'] ?: "arsse_test",
|
||||
'dbMySQLPass' => $_ENV['ARSSE_TEST_MYSQL_PASS'] ?: "arsse_test",
|
||||
'dbMySQLDb' => $_ENV['ARSSE_TEST_MYSQL_DB'] ?: "arsse_test",
|
||||
];
|
||||
Arsse::$conf = (($force ? null : Arsse::$conf) ?? (new Conf))->import($defaults)->import($conf);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,20 @@
|
|||
forceCoversAnnotation="true"
|
||||
>
|
||||
|
||||
<php>
|
||||
<env name="ARSSE_TEST_PGSQL_HOST" value=""/>
|
||||
<env name="ARSSE_TEST_PGSQL_PORT" value="5432"/>
|
||||
<env name="ARSSE_TEST_PGSQL_USER" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_PGSQL_PASS" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_PGSQL_DB" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_PGSQL_SCHEMA" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_MYSQL_HOST" value="localhost"/>
|
||||
<env name="ARSSE_TEST_MYSQL_PORT" value="3306"/>
|
||||
<env name="ARSSE_TEST_MYSQL_USER" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_MYSQL_PASS" value="arsse_test"/>
|
||||
<env name="ARSSE_TEST_MYSQL_DB" value="arsse_test"/>
|
||||
</php>
|
||||
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">../lib</directory>
|
||||
|
@ -116,6 +130,7 @@
|
|||
</testsuite>
|
||||
<testsuite name="Import/Export">
|
||||
<file>cases/ImportExport/TestFile.php</file>
|
||||
<file>cases/ImportExport/TestImportExport.php</file>
|
||||
<file>cases/ImportExport/TestOPML.php</file>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
|
Loading…
Reference in a new issue