mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-08 17:02: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 */
|
/** @dataProvider provideBinaryBindings */
|
||||||
public function testHandleBinaryData($value, string $type, string $exp) {
|
public function testHandleBinaryData($value, string $type, string $exp) {
|
||||||
if (in_array(static::$implementation, ["PostgreSQL", "PDO PostgreSQL"])) {
|
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") {
|
if ($exp === "null") {
|
||||||
$query = "SELECT (? is null) as pass";
|
$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) {
|
public static function setConf(array $conf = [], bool $force = true) {
|
||||||
$defaults = [
|
$defaults = [
|
||||||
'dbSQLite3File' => ":memory:",
|
'dbSQLite3File' => ":memory:",
|
||||||
'dbSQLite3Timeout' => 0,
|
'dbSQLite3Timeout' => 0,
|
||||||
'dbPostgreSQLUser' => "arsse_test",
|
'dbPostgreSQLHost' => $_ENV['ARSSE_TEST_PGSQL_HOST'] ?: "",
|
||||||
'dbPostgreSQLPass' => "arsse_test",
|
'dbPostgreSQLPort' => $_ENV['ARSSE_TEST_PGSQL_PORT'] ?: 5432,
|
||||||
'dbPostgreSQLDb' => "arsse_test",
|
'dbPostgreSQLUser' => $_ENV['ARSSE_TEST_PGSQL_USER'] ?: "arsse_test",
|
||||||
'dbPostgreSQLSchema' => "arsse_test",
|
'dbPostgreSQLPass' => $_ENV['ARSSE_TEST_PGSQL_PASS'] ?: "arsse_test",
|
||||||
'dbMySQLUser' => "arsse_test",
|
'dbPostgreSQLDb' => $_ENV['ARSSE_TEST_PGSQL_DB'] ?: "arsse_test",
|
||||||
'dbMySQLPass' => "arsse_test",
|
'dbPostgreSQLSchema' => $_ENV['ARSSE_TEST_PGSQL_SCHEMA'] ?: "arsse_test",
|
||||||
'dbMySQLDb' => "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);
|
Arsse::$conf = (($force ? null : Arsse::$conf) ?? (new Conf))->import($defaults)->import($conf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,20 @@
|
||||||
forceCoversAnnotation="true"
|
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>
|
<filter>
|
||||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
<directory suffix=".php">../lib</directory>
|
<directory suffix=".php">../lib</directory>
|
||||||
|
@ -116,6 +130,7 @@
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Import/Export">
|
<testsuite name="Import/Export">
|
||||||
<file>cases/ImportExport/TestFile.php</file>
|
<file>cases/ImportExport/TestFile.php</file>
|
||||||
|
<file>cases/ImportExport/TestImportExport.php</file>
|
||||||
<file>cases/ImportExport/TestOPML.php</file>
|
<file>cases/ImportExport/TestOPML.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
Loading…
Reference in a new issue