Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Feb 20, 2025
1 parent fe21217 commit a007860
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
11 changes: 9 additions & 2 deletions tests/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ final class ColumnTest extends AbstractColumnTest

public function testPhpTypeCast(): void
{
if (version_compare($this->getConnection()->getServerInfo()->getVersion(), '21', '>=')) {
$db = $this->getConnection();

if (version_compare($db->getServerInfo()->getVersion(), '21', '>=')) {
$this->fixture = 'oci21.sql';
}

$db->close();
$db = $this->getConnection(true);

$command = $db->createCommand();
Expand Down Expand Up @@ -78,11 +81,15 @@ public function testPhpTypeCast(): void

public function testColumnInstance(): void
{
if (version_compare($this->getConnection()->getServerInfo()->getVersion(), '21', '>=')) {
$db = $this->getConnection();

if (version_compare($db->getServerInfo()->getVersion(), '21', '>=')) {
$this->fixture = 'oci21.sql';
}

$db->close();
$db = $this->getConnection(true);

$schema = $db->getSchema();
$tableSchema = $schema->getTableSchema('type');

Expand Down
6 changes: 5 additions & 1 deletion tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ public function testBatchInsert(
array $expectedParams = [],
int $insertedRow = 1
): void {
if (version_compare($this->getConnection()->getServerInfo()->getVersion(), '21', '>=')) {
$db = $this->getConnection();

if (version_compare($db->getServerInfo()->getVersion(), '21', '>=')) {
$this->fixture = 'oci21.sql';
}

$db->close();

parent::testBatchInsert($table, $values, $columns, $expected, $expectedParams, $insertedRow);
}

Expand Down
6 changes: 5 additions & 1 deletion tests/Provider/QueryBuilderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ public static function buildColumnDefinition(): array
$values['reference($reference)'][0] = 'number(10) REFERENCES "ref_table" ("id") ON DELETE CASCADE';
$values['reference($referenceWithSchema)'][0] = 'number(10) REFERENCES "ref_schema"."ref_table" ("id") ON DELETE CASCADE';

if (version_compare(self::getDb()->getServerInfo()->getVersion(), '21', '>=')) {
$db = self::getDb();

if (version_compare($db->getServerInfo()->getVersion(), '21', '>=')) {
$values['array()'][0] = 'json';
$values['structured()'][0] = 'json';
$values['json()'][0] = 'json';
Expand All @@ -362,6 +364,8 @@ public static function buildColumnDefinition(): array
];
}

$db->close();

return [
...$values,

Expand Down
4 changes: 3 additions & 1 deletion tests/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ final class SchemaTest extends CommonSchemaTest
*/
public function testColumns(array $columns, string $tableName = 'type'): void
{
$version21 = version_compare($this->getConnection()->getServerInfo()->getVersion(), '21', '>=');
$db = $this->getConnection();
$version21 = version_compare($db->getServerInfo()->getVersion(), '21', '>=');
$db->close();

if ($version21 && $tableName === 'type') {
$this->fixture = 'oci21.sql';
Expand Down

0 comments on commit a007860

Please sign in to comment.