From cb71a9efd7a6fc1fbf57c821895879a65d5f02c7 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sat, 22 Jun 2019 10:29:26 -0400 Subject: [PATCH] Make database connections for testing configurable --- tests/cases/Db/BaseStatement.php | 2 +- tests/lib/AbstractTest.php | 22 +++++++++++++--------- tests/phpunit.xml | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tests/cases/Db/BaseStatement.php b/tests/cases/Db/BaseStatement.php index cdc74a7..f62c3e8 100644 --- a/tests/cases/Db/BaseStatement.php +++ b/tests/cases/Db/BaseStatement.php @@ -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"; diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index 6b4de82..b1b79f1 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -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); } diff --git a/tests/phpunit.xml b/tests/phpunit.xml index fb753f3..5617ddb 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -10,6 +10,20 @@ forceCoversAnnotation="true" > + + + + + + + + + + + + + + ../lib @@ -116,6 +130,7 @@ cases/ImportExport/TestFile.php + cases/ImportExport/TestImportExport.php cases/ImportExport/TestOPML.php