Update testdox for integration tests
This commit is contained in:
@@ -34,6 +34,7 @@ class FindTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
#[TestDox('all() succeeds when there is data')]
|
||||
public function testAllSucceedsWhenThereIsData(): void
|
||||
{
|
||||
$docs = Find::all(ThrowawayDb::TABLE, TestDocument::class);
|
||||
@@ -43,6 +44,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals(5, $count, 'There should have been 5 documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('all() succeeds when there is no data')]
|
||||
public function testAllSucceedsWhenThereIsNoData(): void
|
||||
{
|
||||
Custom::nonQuery('DELETE FROM ' . ThrowawayDb::TABLE, []);
|
||||
@@ -51,7 +53,7 @@ class FindTest extends TestCase
|
||||
$this->assertFalse($docs->hasItems(), 'There should have been no documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds when a document is found')]
|
||||
#[TestDox('byId() succeeds when a document is found')]
|
||||
public function testByIdSucceedsWhenADocumentIsFound(): void
|
||||
{
|
||||
$doc = Find::byId(ThrowawayDb::TABLE, 'two', TestDocument::class);
|
||||
@@ -59,7 +61,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals('two', $doc->get()->id, 'An incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds when a document is found with numeric ID')]
|
||||
#[TestDox('byId() succeeds when a document is found with numeric ID')]
|
||||
public function testByIdSucceedsWhenADocumentIsFoundWithNumericId(): void
|
||||
{
|
||||
Delete::byFields(ThrowawayDb::TABLE, [Field::notExists('absent')]);
|
||||
@@ -69,13 +71,14 @@ class FindTest extends TestCase
|
||||
$this->assertEquals(18, $doc->get()->id, 'An incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds when a document is not found')]
|
||||
#[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');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds when documents are found')]
|
||||
public function testByFieldsSucceedsWhenDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byFields(ThrowawayDb::TABLE, [Field::greater('num_value', 15)], TestDocument::class);
|
||||
@@ -85,6 +88,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals(2, $count, 'There should have been 2 documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds when no documents are found')]
|
||||
public function testByFieldsSucceedsWhenNoDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byFields(ThrowawayDb::TABLE, [Field::greater('num_value', 100)], TestDocument::class);
|
||||
@@ -92,6 +96,7 @@ class FindTest extends TestCase
|
||||
$this->assertFalse($docs->hasItems(), 'There should have been no documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('byContains() succeeds when documents are found')]
|
||||
public function testByContainsSucceedsWhenDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byContains(ThrowawayDb::TABLE, ['value' => 'purple'], TestDocument::class);
|
||||
@@ -101,6 +106,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals(2, $count, 'There should have been 2 documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('byContains() succeeds when no documents are found')]
|
||||
public function testByContainsSucceedsWhenNoDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byContains(ThrowawayDb::TABLE, ['value' => 'indigo'], TestDocument::class);
|
||||
@@ -108,7 +114,7 @@ class FindTest extends TestCase
|
||||
$this->assertFalse($docs->hasItems(), 'The document list should be empty');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds when documents are found')]
|
||||
#[TestDox('byJsonPath() succeeds when documents are found')]
|
||||
public function testByJsonPathSucceedsWhenDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 10)', TestDocument::class);
|
||||
@@ -118,7 +124,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals(2, $count, 'There should have been 2 documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds when no documents are found')]
|
||||
#[TestDox('byJsonPath() succeeds when no documents are found')]
|
||||
public function testByJsonPathSucceedsWhenNoDocumentsAreFound(): void
|
||||
{
|
||||
$docs = Find::byJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 100)', TestDocument::class);
|
||||
@@ -126,6 +132,7 @@ class FindTest extends TestCase
|
||||
$this->assertFalse($docs->hasItems(), 'The document list should be empty');
|
||||
}
|
||||
|
||||
#[TestDox('firstByFields() succeeds when a document is found')]
|
||||
public function testFirstByFieldsSucceedsWhenADocumentIsFound(): void
|
||||
{
|
||||
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::equal('value', 'another')], TestDocument::class);
|
||||
@@ -133,6 +140,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals('two', $doc->get()->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);
|
||||
@@ -140,12 +148,14 @@ class FindTest extends TestCase
|
||||
$this->assertContains($doc->get()->id, ['two', 'four'], 'An 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');
|
||||
}
|
||||
|
||||
#[TestDox('firstByContains() succeeds when a document is found')]
|
||||
public function testFirstByContainsSucceedsWhenADocumentIsFound(): void
|
||||
{
|
||||
$doc = Find::firstByContains(ThrowawayDb::TABLE, ['value' => 'FIRST!'], TestDocument::class);
|
||||
@@ -153,6 +163,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals('one', $doc->get()->id, 'The incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('firstByContains() succeeds when multiple documents are found')]
|
||||
public function testFirstByContainsSucceedsWhenMultipleDocumentsAreFound(): void
|
||||
{
|
||||
$doc = Find::firstByContains(ThrowawayDb::TABLE, ['value' => 'purple'], TestDocument::class);
|
||||
@@ -160,13 +171,14 @@ class FindTest extends TestCase
|
||||
$this->assertContains($doc->get()->id, ['four', 'five'], 'An incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('firstByContains() succeeds when a document is not found')]
|
||||
public function testFirstByContainsSucceedsWhenADocumentIsNotFound(): void
|
||||
{
|
||||
$doc = Find::firstByContains(ThrowawayDb::TABLE, ['value' => 'indigo'], TestDocument::class);
|
||||
$this->assertTrue($doc->isNone(), 'There should not have been a document returned');
|
||||
}
|
||||
|
||||
#[TestDox('First by JSON Path succeeds when a document is found')]
|
||||
#[TestDox('firstByJsonPath() succeeds when a document is found')]
|
||||
public function testFirstByJsonPathSucceedsWhenADocumentIsFound(): void
|
||||
{
|
||||
$doc = Find::firstByJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ == 10)', TestDocument::class);
|
||||
@@ -174,7 +186,7 @@ class FindTest extends TestCase
|
||||
$this->assertEquals('two', $doc->get()->id, 'The incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('First by JSON Path succeeds when multiple documents are found')]
|
||||
#[TestDox('firstByJsonPath() succeeds when multiple documents are found')]
|
||||
public function testFirstByJsonPathSucceedsWhenMultipleDocumentsAreFound(): void
|
||||
{
|
||||
$doc = Find::firstByJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 10)', TestDocument::class);
|
||||
@@ -182,7 +194,7 @@ class FindTest extends TestCase
|
||||
$this->assertContains($doc->get()->id, ['four', 'five'], 'An incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('First by JSON Path succeeds when a document is not found')]
|
||||
#[TestDox('firstByJsonPath() succeeds when a document is not found')]
|
||||
public function testFirstByJsonPathSucceedsWhenADocumentIsNotFound(): void
|
||||
{
|
||||
$doc = Find::firstByJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 100)', TestDocument::class);
|
||||
|
||||
Reference in New Issue
Block a user