diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f237e0f..02f4884 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: php: [ 8.3, 8.2 ] - database: [ mysql, mariadb, pgsql, sqlite, sqlsrv ] # TODO[L11]: singlestore, firebird + database: [ mysql, mariadb, pgsql, sqlite, sqlsrv, oracle ] # TODO[L11]: singlestore, firebird release: [ stable, lowest ] include: - php: 8.3 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4533305..2bd2132 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -22,10 +22,7 @@ jobs: - name: Install dependencies run: | docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \ - composer require --dev --ignore-platform-req=ext-oci8 yajra/laravel-oci8 - docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \ - composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }} \ - --ignore-platform-req=ext-oci8 + composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }} - name: Analyse code run: | docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \ diff --git a/composer.json b/composer.json index e3d161a..c2fa02e 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "require-dev": { "orchestra/testbench": "^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.5" + "phpunit/phpunit": "^10.5", + "yajra/laravel-oci8": "^11.0" }, "autoload": { "psr-4": { diff --git a/docker-compose.yml b/docker-compose.yml index 0eb88d4..d074857 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,6 +56,17 @@ services: retries: 10 networks: - test + oracle: + image: 'gvenzl/oracle-xe:latest' + environment: + ORACLE_PASSWORD: password + healthcheck: + test: healthcheck.sh + interval: 5s + timeout: 3s + retries: 10 + networks: + - test singlestore: image: 'ghcr.io/singlestore-labs/singlestoredb-dev:latest' environment: diff --git a/src/Query/Grammars/Traits/CompilesOracleExpressions.php b/src/Query/Grammars/Traits/CompilesOracleExpressions.php index c1719c5..84362b7 100644 --- a/src/Query/Grammars/Traits/CompilesOracleExpressions.php +++ b/src/Query/Grammars/Traits/CompilesOracleExpressions.php @@ -4,9 +4,6 @@ use Illuminate\Database\Query\Builder; -/** - * @codeCoverageIgnore - */ trait CompilesOracleExpressions { use CompilesExpressions; diff --git a/tests/EloquentTest.php b/tests/EloquentTest.php index fbab1e7..a18cd38 100644 --- a/tests/EloquentTest.php +++ b/tests/EloquentTest.php @@ -21,14 +21,15 @@ public function testWithExpression() public function testWithRecursiveExpression() { - $query = User::where('id', 3) + $query = User::select('id', 'parent_id', 'followers', 'created_at', 'updated_at') + ->where('id', 3) ->unionAll( - User::select('users.*') + User::select('users.id', 'users.parent_id', 'users.followers', 'users.created_at', 'users.updated_at') ->join('ancestors', 'ancestors.parent_id', '=', 'users.id') ); $users = User::from('ancestors') - ->withRecursiveExpression('ancestors', $query) + ->withRecursiveExpression('ancestors', $query, ['id', 'parent_id', 'followers', 'created_at', 'updated_at']) ->orderBy('id') ->get(); @@ -96,7 +97,7 @@ public function testInsertUsing() public function testUpdate() { - if (in_array($this->connection, ['mariadb', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'oracle', 'firebird'])) { $this->markTestSkipped(); } @@ -111,7 +112,7 @@ public function testUpdate() public function testUpdateWithJoin() { - if (in_array($this->connection, ['mariadb', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'oracle', 'firebird'])) { $this->markTestSkipped(); } @@ -126,7 +127,7 @@ public function testUpdateWithJoin() public function testUpdateWithLimit() { - if (in_array($this->connection, ['mariadb', 'sqlsrv', 'singlestore', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'sqlsrv', 'oracle', 'singlestore', 'firebird'])) { $this->markTestSkipped(); } @@ -143,7 +144,7 @@ public function testUpdateWithLimit() public function testDelete() { - if (in_array($this->connection, ['mariadb', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'oracle', 'firebird'])) { $this->markTestSkipped(); } @@ -156,7 +157,7 @@ public function testDelete() public function testDeleteWithJoin() { - if (in_array($this->connection, ['mariadb', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'oracle', 'firebird'])) { $this->markTestSkipped(); } @@ -170,7 +171,7 @@ public function testDeleteWithJoin() public function testDeleteWithLimit() { - if (in_array($this->connection, ['mariadb', 'sqlsrv', 'firebird'])) { + if (in_array($this->connection, ['mariadb', 'sqlsrv', 'oracle', 'firebird'])) { $this->markTestSkipped(); } diff --git a/tests/QueryTest.php b/tests/QueryTest.php index d37825a..c6350c5 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -9,6 +9,15 @@ class QueryTest extends TestCase { + protected function setUp(): void + { + parent::setUp(); + + if ($this->connection === 'oracle') { + $this->markTestSkipped(); + } + } + public function testWithExpression() { $posts = function (BaseBuilder $query) { diff --git a/tests/TestCase.php b/tests/TestCase.php index 700c833..1f53d65 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,6 +11,7 @@ use Staudenmeir\LaravelCte\Tests\Models\Post; use Staudenmeir\LaravelCte\Tests\Models\User; use SingleStore\Laravel\SingleStoreProvider; +use Yajra\Oci8\Oci8ServiceProvider; abstract class TestCase extends Base { @@ -77,7 +78,7 @@ protected function getEnvironmentSetUp($app) protected function getPackageProviders($app) { - return []; // TODO[L11] - return [SingleStoreProvider::class, FirebirdServiceProvider::class]; + return [Oci8ServiceProvider::class]; // TODO[L11] + return [Oci8ServiceProvider::class, SingleStoreProvider::class, FirebirdServiceProvider::class]; } } diff --git a/tests/config/database.php b/tests/config/database.php index effcbce..8527212 100644 --- a/tests/config/database.php +++ b/tests/config/database.php @@ -58,6 +58,24 @@ 'prefix_indexes' => true, 'encrypt' => 'no', ], + 'oracle' => [ + 'driver' => 'oracle', + 'tns' => '', + 'host' => 'oracle', + 'port' => '1521', + 'database' => 'XE', + 'service_name' => '', + 'username' => 'system', + 'password' => 'password', + 'charset' => 'AL32UTF8', + 'prefix' => '', + 'prefix_schema' => '', + 'edition' => 'ora$base', + 'server_version' => '21c', + 'load_balance' => 'yes', + 'max_name_len' => 128, + 'dynamic' => [], + ], 'singlestore' => [ 'driver' => 'singlestore', 'host' => 'singlestore',