Skip to content

Commit 509f4c3

Browse files
authored
Merge pull request #617 from wayofdev/feat/docs
2 parents 5808bbf + 0cf5139 commit 509f4c3

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

docs/pages/services/testing.mdx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,57 @@ class ExampleTest extends TestCase
7474
}
7575
}
7676
```
77+
78+
## Available Assertions
79+
80+
This adapter package overrides Laravel's assertion methods to make them work with CycleORM entities. Use `WayOfDev\Cycle\Testing\Concerns\InteractsWithDatabase` trait in your base test case or in test cases where it is needed, instead of default Laravel `InteractsWithDatabase` trait.
81+
82+
### `assertDatabaseCount`
83+
84+
Assert that a table in the database contains the given number of records:
85+
86+
```php
87+
$this->assertDatabaseCount('posts', 1);
88+
```
89+
90+
### `assertDatabaseHas`
91+
92+
Assert that a table in the database contains records matching the given key / value query constraints:
93+
94+
```php
95+
$this->assertDatabaseHas('posts', [
96+
'id' => $response->json('id'),
97+
'title' => 'New Post'
98+
]);
99+
```
100+
101+
### `assertDatabaseMissing`
102+
103+
Assert that a table in the database does not contain records matching the given key / value query constraints:
104+
105+
```php
106+
$this->assertDatabaseMissing('posts', [
107+
'id' => $response->json('id'),
108+
'title' => 'New Post'
109+
]);
110+
```
111+
112+
### `assertSoftDeleted`
113+
114+
Assert that a given entity has been soft-deleted:
115+
116+
```php
117+
$this->assertSoftDeleted('posts', [
118+
'id' => $post->id
119+
]);
120+
```
121+
122+
### `assertNotSoftDeleted`
123+
124+
Opposite to `assertSoftDeleted` method. Assert that a given entity has not been soft-deleted:
125+
126+
```php
127+
$this->assertNotSoftDeleted('posts', [
128+
'id' => $post->id
129+
]);
130+
```

0 commit comments

Comments
 (0)