You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/services/testing.mdx
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,3 +74,57 @@ class ExampleTest extends TestCase
74
74
}
75
75
}
76
76
```
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:
0 commit comments