From 026bcf5080930aec4fc7516df2f684eb76c1ed1e Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Mon, 18 Nov 2024 21:14:28 +0500 Subject: [PATCH] WIP --- .github/workflows/build.yml | 6 ++++++ .github/workflows/mutation.yml | 5 +++++ tests/.env | 4 ++-- tests/Support/TestTrait.php | 10 +++++----- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59ae210..6b86ba9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,6 +95,12 @@ jobs: - name: Run tests with phpunit with code coverage. run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always + env: + YII_ORACLE_SID: XE + YII_ORACLE_HOST: localhost + YII_ORACLE_PORT: 1521 + YII_ORACLE_USER: system + YII_ORACLE_PASSWORD: root - name: Upload coverage to Codecov. uses: codecov/codecov-action@v3 diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 40741f4..01c8e0f 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -84,3 +84,8 @@ jobs: vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} + YII_ORACLE_SID: XE + YII_ORACLE_HOST: localhost + YII_ORACLE_PORT: 1521 + YII_ORACLE_USER: system + YII_ORACLE_PASSWORD: root diff --git a/tests/.env b/tests/.env index a355b62..183ab6e 100644 --- a/tests/.env +++ b/tests/.env @@ -1,6 +1,6 @@ ENVIRONMENT=local -YII_ORACLE_DATABASE= +YII_ORACLE_SID=XE YII_ORACLE_HOST=oracle -YII_ORACLE_PORT= +YII_ORACLE_PORT=1521 YII_ORACLE_USER=system YII_ORACLE_PASSWORD=root diff --git a/tests/Support/TestTrait.php b/tests/Support/TestTrait.php index 702ab79..0f67cca 100644 --- a/tests/Support/TestTrait.php +++ b/tests/Support/TestTrait.php @@ -36,7 +36,7 @@ protected static function getDb(): PdoConnectionInterface { $dsn = (new Dsn( host: self::getHost(), - databaseName: self::getDatabaseName(), + databaseName: self::getSid(), port: self::getPort(), options: ['charset' => 'AL32UTF8'], ))->asString(); @@ -49,7 +49,7 @@ protected function getDsn(): string if ($this->dsn === '') { $this->dsn = (new Dsn( host: self::getHost(), - databaseName: self::getDatabaseName(), + databaseName: self::getSid(), port: self::getPort(), options: ['charset' => 'AL32UTF8'], ))->asString(); @@ -73,9 +73,9 @@ private function getDriver(): PdoDriverInterface return new Driver($this->getDsn(), self::getUsername(), self::getPassword()); } - private static function getDatabaseName(): string + private static function getSid(): string { - return getenv('YII_ORACLE_DATABASE') ?: 'XE'; + return getenv('YII_ORACLE_SID'); } private static function getHost(): string @@ -85,7 +85,7 @@ private static function getHost(): string private static function getPort(): string { - return getenv('YII_ORACLE_PORT') ?: '1521'; + return getenv('YII_ORACLE_PORT'); } private static function getUsername(): string