From a63ce24bde167e9ecbf86a469e0b8a77579300d4 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Mon, 2 Dec 2024 22:15:29 +0500 Subject: [PATCH] WIP --- .github/workflows/build.yml | 3 ++- .github/workflows/mutation.yml | 3 ++- tests/CommandTest.php | 12 +----------- tests/Support/TestTrait.php | 15 ++++++++++----- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b86ba9..e371226 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: ports: - 1521:1521 env: - ORACLE_DATABASE : yiitest + ORACLE_DATABASE: FREEPDB1 ORACLE_PASSWORD : root options: >- --name=oci @@ -97,6 +97,7 @@ jobs: run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always env: YII_ORACLE_SID: XE + YII_ORACLE_DATABASE: FREEPDB1 YII_ORACLE_HOST: localhost YII_ORACLE_PORT: 1521 YII_ORACLE_USER: system diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 01c8e0f..7c203a3 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -42,7 +42,7 @@ jobs: ports: - 1521:1521 env: - ORACLE_DATABASE : yiitest + ORACLE_DATABASE: FREEPDB1 ORACLE_PASSWORD : root options: >- --name=oci @@ -85,6 +85,7 @@ jobs: env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} YII_ORACLE_SID: XE + YII_ORACLE_DATABASE: FREEPDB1 YII_ORACLE_HOST: localhost YII_ORACLE_PORT: 1521 YII_ORACLE_USER: system diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 89a1374..5366867 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -13,14 +13,10 @@ use Yiisoft\Db\Exception\InvalidCallException; use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Exception\NotSupportedException; -use Yiisoft\Db\Oracle\Connection; -use Yiisoft\Db\Oracle\Dsn; -use Yiisoft\Db\Oracle\Driver; use Yiisoft\Db\Oracle\Tests\Support\TestTrait; use Yiisoft\Db\Query\Query; use Yiisoft\Db\Tests\Common\CommonCommandTest; use Yiisoft\Db\Tests\Support\Assert; -use Yiisoft\Db\Tests\Support\DbHelper; use Yiisoft\Db\Transaction\TransactionInterface; use function is_resource; @@ -628,12 +624,6 @@ public function testProfilerData(string $sql = null): void public function testShowDatabases(): void { - $dsn = new Dsn('oci', 'localhost'); - $db = new Connection(new Driver($dsn->asString(), 'SYSTEM', 'root'), DbHelper::getSchemaCache()); - - $command = $db->createCommand(); - - $this->assertSame('oci:dbname=localhost:1521', $db->getDriver()->getDsn()); - $this->assertSame(['YIITEST'], $command->showDatabases()); + $this->assertSame([self::getDatabaseName()], self::getDb()->createCommand()->showDatabases()); } } diff --git a/tests/Support/TestTrait.php b/tests/Support/TestTrait.php index 0f67cca..139ea5b 100644 --- a/tests/Support/TestTrait.php +++ b/tests/Support/TestTrait.php @@ -75,26 +75,31 @@ private function getDriver(): PdoDriverInterface private static function getSid(): string { - return getenv('YII_ORACLE_SID'); + return getenv('YII_ORACLE_SID') ?? ''; + } + + private static function getDatabaseName(): string + { + return getenv('YII_ORACLE_DATABASE') ?? ''; } private static function getHost(): string { - return getenv('YII_ORACLE_HOST'); + return getenv('YII_ORACLE_HOST') ?? ''; } private static function getPort(): string { - return getenv('YII_ORACLE_PORT'); + return getenv('YII_ORACLE_PORT') ?? ''; } private static function getUsername(): string { - return getenv('YII_ORACLE_USER'); + return getenv('YII_ORACLE_USER') ?? ''; } private static function getPassword(): string { - return getenv('YII_ORACLE_PASSWORD'); + return getenv('YII_ORACLE_PASSWORD') ?? ''; } }