Skip to content

Commit 5dd998b

Browse files
committed
More Oracle fixes
1 parent dd3501b commit 5dd998b

File tree

5 files changed

+61
-34
lines changed

5 files changed

+61
-34
lines changed

src/QueryFactory/AbstractQueryFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected function getColumnsList(string $mainTable, array $additionalTablesFetc
141141
}
142142
} elseif ($orderByColumn['type'] === 'expr') {
143143
$sortColumnName = 'sort_column_'.$sortColumn;
144-
$columnsList[] = $orderByColumn['expr'].' as '.$sortColumnName;
144+
$columnsList[] = $orderByColumn['expr'].' as '.$connection->quoteIdentifier($sortColumnName);
145145
$columnDescList[$sortColumnName] = [
146146
'tableGroup' => null,
147147
];

tests/TDBMAbstractServiceTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ private static function initSchema(Connection $connection): void
329329
->column('name')->string();
330330

331331
$db->table('nodes')
332-
->column('id')->integer()->primaryKey()->autoIncrement()->comment('@JsonIgnore')
332+
->column('id')->integer()->primaryKey()->autoIncrement()->comment("@JsonIgnore\n@Autoincrement")
333333
->column('alias_id')->references('nodes')->null()->comment('@JsonRecursive')
334334
->column('parent_id')->references('nodes')->null()->comment('@JsonInclude')
335335
->column('root_id')->references('nodes')->null()->comment('@JsonIgnore')
@@ -590,53 +590,53 @@ private static function initSchema(Connection $connection): void
590590
'id' => 1,
591591
'owner_id' => 1,
592592
'name' => '/',
593-
'created_at' => (new DateTime('last year'))->format('Y-m-d H:i:s'),
593+
'created_at' => (new DateTime('last year'))->format('Y-m-d 00:00:00'),
594594
]);
595595
self::insert($connection, 'nodes', [
596596
'id' => 2,
597597
'name' => 'private',
598-
'created_at' => (new DateTime('last year'))->format('Y-m-d H:i:s'),
598+
'created_at' => (new DateTime('last year'))->format('Y-m-d 00:00:00'),
599599
'parent_id' => 1,
600600
]);
601601
self::insert($connection, 'nodes', [
602602
'id' => 3,
603603
'name' => 'var',
604-
'created_at' => (new DateTime('last year'))->format('Y-m-d H:i:s'),
604+
'created_at' => (new DateTime('last year'))->format('Y-m-d 00:00:00'),
605605
'parent_id' => 2,
606606
]);
607607
self::insert($connection, 'nodes', [
608608
'id' => 4,
609609
'name' => 'var',
610-
'created_at' => (new DateTime('last year'))->format('Y-m-d H:i:s'),
610+
'created_at' => (new DateTime('last year'))->format('Y-m-d 00:00:00'),
611611
'parent_id' => 1,
612612
'alias_id' => 3
613613
]);
614614
self::insert($connection, 'nodes', [
615615
'id' => 5,
616616
'name' => 'www',
617-
'created_at' => (new DateTime('last week'))->format('Y-m-d H:i:s'),
617+
'created_at' => (new DateTime('last week'))->format('Y-m-d 00:00:00'),
618618
'parent_id' => 4
619619
]);
620620
self::insert($connection, 'nodes', [
621621
'id' => 6,
622622
'owner_id' => 2,
623623
'name' => 'index.html',
624-
'created_at' => (new DateTime('now'))->format('Y-m-d H:i:s'),
624+
'created_at' => (new DateTime('now'))->format('Y-m-d 00:00:00'),
625625
'size' => 512,
626626
'weight' => 42.5,
627627
'parent_id' => 5
628628
]);
629629
self::insert($connection, 'nodes', [
630630
'id' => 7,
631631
'name' => 'index.html',
632-
'created_at' => (new DateTime('now'))->format('Y-m-d H:i:s'),
632+
'created_at' => (new DateTime('now'))->format('Y-m-d 00:00:00'),
633633
'alias_id' => 6,
634634
'parent_id' => 1
635635
]);
636636
self::insert($connection, 'nodes', [
637637
'id' => 8,
638638
'name' => 'index.htm',
639-
'created_at' => (new DateTime('now'))->format('Y-m-d H:i:s'),
639+
'created_at' => (new DateTime('now'))->format('Y-m-d 00:00:00'),
640640
'alias_id' => 7,
641641
'parent_id' => 1
642642
]);

tests/TDBMDaoGeneratorTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
2727
use Doctrine\DBAL\Platforms\MySQL57Platform;
2828
use Doctrine\DBAL\Platforms\MySqlPlatform;
29+
use Doctrine\DBAL\Platforms\OraclePlatform;
2930
use Mouf\Database\SchemaAnalyzer\SchemaAnalyzer;
3031
use Ramsey\Uuid\Uuid;
3132
use ReflectionClass;
@@ -1465,6 +1466,9 @@ public function testGetOnAllNullableValues(): void
14651466
*/
14661467
public function testExceptionOnMultipleInheritance(): void
14671468
{
1469+
// Because of the sequence on the PK, we cannot set the PK to 99 at all.
1470+
$this->skipOracle();
1471+
14681472
$connection = self::getConnection();
14691473
self::insert($connection, 'animal', [
14701474
'id' => 99, 'name' => 'Snoofield',
@@ -1745,6 +1749,10 @@ public function testRecursiveSave(): void
17451749
*/
17461750
public function testBlob(): void
17471751
{
1752+
// An issue in DBAL makes using BLOB type impossible with resources.
1753+
// See https://github.com/doctrine/dbal/issues/3290
1754+
$this->skipOracle();
1755+
17481756
$fp = fopen(__FILE__, 'r');
17491757
$file = new FileBean($fp);
17501758

@@ -1767,6 +1775,10 @@ public function testBlob(): void
17671775
*/
17681776
public function testReadBlob(): void
17691777
{
1778+
// An issue in DBAL makes using BLOB type impossible with resources.
1779+
// See https://github.com/doctrine/dbal/issues/3290
1780+
$this->skipOracle();
1781+
17701782
$fileDao = new FileDao($this->tdbmService);
17711783
$loadedFile = $fileDao->getById(1);
17721784

@@ -1787,6 +1799,10 @@ public function testReadBlob(): void
17871799
*/
17881800
public function testReadAndSaveBlob(): void
17891801
{
1802+
// An issue in DBAL makes using BLOB type impossible with resources.
1803+
// See https://github.com/doctrine/dbal/issues/3290
1804+
$this->skipOracle();
1805+
17901806
$fileDao = new FileDao($this->tdbmService);
17911807
$loadedFile = $fileDao->getById(1);
17921808

@@ -1801,6 +1817,10 @@ public function testReadAndSaveBlob(): void
18011817
*/
18021818
public function testProtectedGetterSetter(): void
18031819
{
1820+
// An issue in DBAL makes using BLOB type impossible with resources.
1821+
// See https://github.com/doctrine/dbal/issues/3290
1822+
$this->skipOracle();
1823+
18041824
$md5Getter = new ReflectionMethod(FileBaseBean::class, 'getMd5');
18051825
$md5Setter = new ReflectionMethod(FileBaseBean::class, 'setMd5');
18061826

@@ -2328,4 +2348,11 @@ public function testCanReadVirtualColumn(): void
23282348
$player = $dao->getById(1);
23292349
$this->assertSame('Sally', $player->getNamesVirtual());
23302350
}
2351+
2352+
private function skipOracle()
2353+
{
2354+
if (self::getConnection()->getDatabasePlatform() instanceof OraclePlatform) {
2355+
$this->markTestSkipped('Not supported in Oracle');
2356+
}
2357+
}
23312358
}

vendor-bin/couscous/composer.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor-bin/require-checker/composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)