Update to PHP 8.4, new option lib

This commit is contained in:
2024-09-30 23:39:23 -04:00
parent df436c9ef4
commit 4b29345dc7
16 changed files with 151 additions and 151 deletions

View File

@@ -86,8 +86,8 @@ class FindTest extends TestCase
public function testByIdSucceedsWhenADocumentIsFound(): void
{
$doc = Find::byId(ThrowawayDb::TABLE, 'two', TestDocument::class);
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
$this->assertEquals('two', $doc->get()->id, 'An incorrect document was returned');
$this->assertTrue($doc->isSome, 'There should have been a document returned');
$this->assertEquals('two', $doc->value->id, 'An incorrect document was returned');
}
#[TestDox('byId() succeeds when a document is found with numeric ID')]
@@ -95,15 +95,15 @@ class FindTest extends TestCase
{
Document::insert(ThrowawayDb::TABLE, ['id' => 18, 'value' => 'howdy']);
$doc = Find::byId(ThrowawayDb::TABLE, 18, TestDocument::class);
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
$this->assertEquals('18', $doc->get()->id, 'An incorrect document was returned');
$this->assertTrue($doc->isSome, 'There should have been a document returned');
$this->assertEquals('18', $doc->value->id, 'An incorrect document was returned');
}
#[TestDox('byId() succeeds when a document is not found')]
public function testByIdSucceedsWhenADocumentIsNotFound(): void
{
$doc = Find::byId(ThrowawayDb::TABLE, 'seventy-five', TestDocument::class);
$this->assertTrue($doc->isNone(), 'There should not have been a document returned');
$this->assertTrue($doc->isNone, 'There should not have been a document returned');
}
#[TestDox('byFields() succeeds when documents are found')]
@@ -187,16 +187,16 @@ class FindTest extends TestCase
public function testFirstByFieldsSucceedsWhenADocumentIsFound(): void
{
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::equal('value', 'another')], TestDocument::class);
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
$this->assertEquals('two', $doc->get()->id, 'The incorrect document was returned');
$this->assertTrue($doc->isSome, 'There should have been a document returned');
$this->assertEquals('two', $doc->value->id, 'The incorrect document was returned');
}
#[TestDox('firstByFields() succeeds when multiple documents are found')]
public function testFirstByFieldsSucceedsWhenMultipleDocumentsAreFound(): void
{
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::equal('sub.foo', 'green')], TestDocument::class);
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
$this->assertContains($doc->get()->id, ['two', 'four'], 'An incorrect document was returned');
$this->assertTrue($doc->isSome, 'There should have been a document returned');
$this->assertContains($doc->value->id, ['two', 'four'], 'An incorrect document was returned');
}
#[TestDox('firstByFields() succeeds when multiple ordered documents are found')]
@@ -204,15 +204,15 @@ class FindTest extends TestCase
{
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::equal('sub.foo', 'green')], TestDocument::class,
orderBy: [Field::named('n:num_value DESC')]);
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
$this->assertEquals('four', $doc->get()->id, 'The incorrect document was returned');
$this->assertTrue($doc->isSome, 'There should have been a document returned');
$this->assertEquals('four', $doc->value->id, 'The incorrect document was returned');
}
#[TestDox('firstByFields() succeeds when a document is not found')]
public function testFirstByFieldsSucceedsWhenADocumentIsNotFound(): void
{
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::equal('value', 'absent')], TestDocument::class);
$this->assertTrue($doc->isNone(), 'There should not have been a document returned');
$this->assertTrue($doc->isNone, 'There should not have been a document returned');
}
#[TestDox('firstByContains() fails')]