Skip to content

Commit

Permalink
Test Oracle support
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Mar 9, 2024
1 parent 635fd80 commit 3d801a5
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} \
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions src/Query/Grammars/Traits/CompilesOracleExpressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use Illuminate\Database\Query\Builder;

/**
* @codeCoverageIgnore
*/
trait CompilesOracleExpressions
{
use CompilesExpressions;
Expand Down
19 changes: 10 additions & 9 deletions tests/EloquentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand Down
9 changes: 9 additions & 0 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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];
}
}
18 changes: 18 additions & 0 deletions tests/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 3d801a5

Please sign in to comment.