Skip to content

Commit 87a706c

Browse files
committed
test: skip SQLite3
SQLite3::escapeString() is not binary safe. https://www.php.net/manual/en/sqlite3.escapestring.php
1 parent c0a86fd commit 87a706c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/system/Models/UpdateModelTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ public function testUpdateEntityWithPrimaryKeyCast(): void
384384
$this->db->DBDriver === 'OCI8'
385385
|| $this->db->DBDriver === 'Postgre'
386386
|| $this->db->DBDriver === 'SQLSRV'
387+
|| $this->db->DBDriver === 'SQLite3'
387388
) {
388389
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
389390
}
@@ -409,6 +410,51 @@ public function testUpdateEntityWithPrimaryKeyCast(): void
409410
$this->assertSame('id', $entity->value);
410411
}
411412

413+
public function testUpdateBatchEntityWithPrimaryKeyCast(): void
414+
{
415+
if (
416+
$this->db->DBDriver === 'OCI8'
417+
|| $this->db->DBDriver === 'Postgre'
418+
|| $this->db->DBDriver === 'SQLSRV'
419+
|| $this->db->DBDriver === 'SQLite3'
420+
) {
421+
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
422+
}
423+
424+
$this->createUuidTable();
425+
426+
$this->createModel(UUIDPkeyModel::class);
427+
428+
$entity1 = new UUID();
429+
$entity1->id = '550e8400-e29b-41d4-a716-446655440000';
430+
$entity1->value = 'test1';
431+
$id1 = $this->model->insert($entity1);
432+
433+
$entity2 = new UUID();
434+
$entity2->id = 'bd59cff1-7a24-dde5-ac10-7b929db6da8c';
435+
$entity2->value = 'test2';
436+
$id2 = $this->model->insert($entity2);
437+
438+
$entity1 = $this->model->find($id1);
439+
$entity2 = $this->model->find($id2);
440+
441+
$entity1->value = 'update1';
442+
$entity2->value = 'update2';
443+
444+
$data = [
445+
$entity1,
446+
$entity2,
447+
];
448+
$this->model->updateBatch($data, 'id');
449+
450+
$this->seeInDatabase('uuid', [
451+
'value' => 'update1',
452+
]);
453+
$this->seeInDatabase('uuid', [
454+
'value' => 'update2',
455+
]);
456+
}
457+
412458
private function createUuidTable(): void
413459
{
414460
$forge = Database::forge($this->DBGroup);

0 commit comments

Comments
 (0)