Initial SQLite development #1

Merged
danieljsummers merged 25 commits from develop into main 2024-06-08 23:58:45 +00:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit a10ecbb1cd - Show all commits

View File

@ -15,7 +15,7 @@ class Parameters
*/
public static function id(mixed $key): array
{
return [':id' => is_string($key) ? $key : "$key"];
return [':id' => is_int($key) || is_string($key) ? $key : "$key"];
}
/**

View File

@ -2,7 +2,7 @@
namespace Test\Integration\SQLite;
use BitBadger\PDODocument\{Custom, Field, Find};
use BitBadger\PDODocument\{Custom, Document, Field, Find};
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
use Test\Integration\TestDocument;
@ -53,6 +53,15 @@ class FindTest extends TestCase
$this->assertEquals('two', $doc->id, 'An incorrect document was returned');
}
#[TestDox('By ID succeeds when a document is found with numeric ID')]
public function testByIdSucceedsWhenADocumentIsFoundWithNumericId(): void
{
Document::insert(ThrowawayDb::TABLE, ['id' => 18, 'value' => 'howdy']);
$doc = Find::byId(ThrowawayDb::TABLE, 18, TestDocument::class);
$this->assertNotFalse($doc, 'There should have been a document returned');
$this->assertEquals('18', $doc->id, 'An incorrect document was returned');
}
#[TestDox('By ID succeeds when a document is not found')]
public function testByIdSucceedsWhenADocumentIsNotFound(): void
{