Skip to content

Commit

Permalink
test: skip SQLite3
Browse files Browse the repository at this point in the history
SQLite3::escapeString() is not binary safe.
https://www.php.net/manual/en/sqlite3.escapestring.php
  • Loading branch information
kenjis committed Dec 1, 2023
1 parent c0a86fd commit 87a706c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/system/Models/UpdateModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public function testUpdateEntityWithPrimaryKeyCast(): void
$this->db->DBDriver === 'OCI8'
|| $this->db->DBDriver === 'Postgre'
|| $this->db->DBDriver === 'SQLSRV'
|| $this->db->DBDriver === 'SQLite3'
) {
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
}
Expand All @@ -409,6 +410,51 @@ public function testUpdateEntityWithPrimaryKeyCast(): void
$this->assertSame('id', $entity->value);
}

public function testUpdateBatchEntityWithPrimaryKeyCast(): void
{
if (
$this->db->DBDriver === 'OCI8'
|| $this->db->DBDriver === 'Postgre'
|| $this->db->DBDriver === 'SQLSRV'
|| $this->db->DBDriver === 'SQLite3'
) {
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
}

$this->createUuidTable();

$this->createModel(UUIDPkeyModel::class);

$entity1 = new UUID();
$entity1->id = '550e8400-e29b-41d4-a716-446655440000';
$entity1->value = 'test1';
$id1 = $this->model->insert($entity1);

$entity2 = new UUID();
$entity2->id = 'bd59cff1-7a24-dde5-ac10-7b929db6da8c';
$entity2->value = 'test2';
$id2 = $this->model->insert($entity2);

$entity1 = $this->model->find($id1);
$entity2 = $this->model->find($id2);

$entity1->value = 'update1';
$entity2->value = 'update2';

$data = [
$entity1,
$entity2,
];
$this->model->updateBatch($data, 'id');

$this->seeInDatabase('uuid', [
'value' => 'update1',
]);
$this->seeInDatabase('uuid', [
'value' => 'update2',
]);
}

private function createUuidTable(): void
{
$forge = Database::forge($this->DBGroup);
Expand Down

0 comments on commit 87a706c

Please sign in to comment.