Skip to content

Commit 3a25ad3

Browse files
committed
Remove Eloquent assertions
1 parent 41ea4b1 commit 3a25ad3

File tree

14 files changed

+0
-754
lines changed

14 files changed

+0
-754
lines changed

README.md

Lines changed: 0 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,6 @@ Laravel-specific Testing Helpers and Assertions.
8787
- [assertDatabaseMissingTable](#assertdatabasemissingtable)
8888
- [assertDatabaseHasMany](#assertdatabasehasmany)
8989
- [assertDatabaseMissingMany](#assertdatabasemissingmany)
90-
- [EloquentAsserts](#eloquentasserts)
91-
- [assertEloquentTableEquals](#asserteloquenttableequals)
92-
- [assertEloquentTableNotEquals](#asserteloquenttablenotequals)
93-
- [assertEloquentIsIncrementing](#asserteloquentisincrementing)
94-
- [assertEloquentIsNotIncrementing](#asserteloquentisnotincrementing)
95-
- [assertEloquentFillableEquals](#asserteloquentfillableequals)
96-
- [assertEloquentFillableNotEquals](#asserteloquentfillablenotequals)
97-
- [assertEloquentDatesEquals](#asserteloquentdatesequals)
98-
- [assertEloquentDatesNotEquals](#asserteloquentdatesnotequals)
99-
- [assertEloquentTouchesEquals](#asserteloquenttouchesequals)
100-
- [assertEloquentTouchesNotEquals](#asserteloquenttouchesnotequals)
101-
- [assertEloquentHasMany](#asserteloquenthasmany)
102-
- [assertEloquentHasCreateFor](#asserteloquenthascreatefor)
103-
- [assertEloquentHasCreateManyFor](#asserteloquenthascreatemanyfor)
104-
- [assertEloquentBelongsTo](#asserteloquentbelongsto)
10590
- [ExceptionAsserts](#exceptionasserts)
10691
- [willSeeException](#willseeexception)
10792
- [FilesystemAsserts](#filesystemasserts)
@@ -221,176 +206,6 @@ $this->assertDatabaseMissingMany('posts', [
221206
]);
222207
```
223208

224-
### EloquentAsserts
225-
226-
#### `assertEloquentTableEquals()`
227-
228-
Assert that the model's table name equals to the given value:
229-
230-
```php
231-
$this->assertEloquentTableEquals(User::class, 'users');
232-
```
233-
234-
#### `assertEloquentTableNotEquals()`
235-
236-
Assert that the model's table name doesn't equal to the given value:
237-
238-
```php
239-
$this->assertEloquentTableNotEquals(User::class, 'posts');
240-
```
241-
242-
#### `assertEloquentIsIncrementing()`
243-
244-
Assert that the model's primary key is incrementing:
245-
246-
```php
247-
$this->assertEloquentIsIncrementing(Post::class);
248-
```
249-
250-
#### `assertEloquentIsNotIncrementing()`
251-
252-
Assert that the model's primary key is not incrementing:
253-
254-
```php
255-
$this->assertEloquentIsNotIncrementing(Category::class);
256-
```
257-
258-
#### `assertEloquentFillableEquals()`
259-
260-
Assert that the model's `fillable` field equals to the given value:
261-
262-
```php
263-
$this->assertEloquentFillableEquals(Post::class, ['title', 'publish_at']);
264-
```
265-
266-
#### `assertEloquentFillableNotEquals()`
267-
268-
Assert that the model's `fillable` field doesn't equal to the given value:
269-
270-
```php
271-
$this->assertEloquentFillableNotEquals(Post::class, ['title', 'body', 'publish_at']);
272-
```
273-
274-
#### `assertEloquentDatesEquals()`
275-
276-
Assert that the model's `dates` field equals to the given value:
277-
278-
```php
279-
$this->assertEloquentDatesEquals(Post::class, ['publish_at', 'created_at', 'updated_at']);
280-
```
281-
282-
#### `assertEloquentDatesNotEquals()`
283-
284-
Assert that the model's `dates` field doesn't equal to the given value:
285-
286-
```php
287-
$this->assertEloquentDatesNotEquals(Post::class, ['publish_at']);
288-
```
289-
290-
#### `assertEloquentTouchesEquals()`
291-
292-
Assert that the model's `touches` field equals to the given value:
293-
294-
```php
295-
$this->assertEloquentTouchesEquals(Comment::class, ['post']);
296-
```
297-
298-
#### `assertEloquentTouchesNotEquals()`
299-
300-
Assert that the model's `touches` field doesn't equal to the given value:
301-
302-
```php
303-
$this->assertEloquentTouchesNotEquals(Comment::class, ['user']);
304-
```
305-
306-
#### `assertEloquentHasMany()`
307-
308-
> NOTE: To use this assertion, you have to create model factories for both classes.
309-
310-
Assert that the model has the given `HasMany` relation:
311-
312-
```php
313-
$this->assertEloquentHasMany(Post::class, 'comments');
314-
```
315-
316-
Assuming that `Post` class has `comments` relation:
317-
318-
```php
319-
class Post extends Model
320-
{
321-
public function comments()
322-
{
323-
return $this->hasMany(Comment::class);
324-
}
325-
}
326-
```
327-
328-
#### `assertEloquentHasCreateFor()`
329-
330-
> NOTE: To use this assertion, you have to create model factories for both classes.
331-
332-
Assert that the model has `create` method for the given `HasMany` relation:
333-
334-
```php
335-
$this->assertEloquentHasCreateFor(Post::class, 'comments');
336-
```
337-
338-
Assuming that `Post` class has `createComment()` method:
339-
340-
```php
341-
class Post extends Model
342-
{
343-
public function createComment(array $attributes)
344-
{
345-
return $this->comments()->create($attributes);
346-
}
347-
}
348-
```
349-
350-
#### `assertEloquentHasCreateManyFor()`
351-
352-
> NOTE: To use this assertion, you have to create model factories for both classes.
353-
354-
Assert that the model has `createMany` method for the given `HasMany` relation:
355-
356-
```php
357-
$this->assertEloquentHasCreateManyFor(Post::class, 'comments');
358-
```
359-
360-
Assuming that `Post` class has `createManyComments()` method:
361-
362-
```php
363-
class Post extends Model
364-
{
365-
public function createManyComments(array $comments)
366-
{
367-
return $this->comments()->createMany($comments);
368-
}
369-
}
370-
```
371-
372-
#### `assertEloquentBelongsTo()`
373-
374-
> NOTE: To use this assertion, you have to create model factories for both classes.
375-
376-
Assert that the model has the given `BelongsTo` relation:
377-
378-
```php
379-
$this->assertEloquentBelongsTo(Comment::class, 'post');
380-
```
381-
382-
Assuming that `Comment` class has `post` relation:
383-
384-
```php
385-
class Comment extends Model
386-
{
387-
public function post()
388-
{
389-
return $this->belongsTo(Post::class);
390-
}
391-
}
392-
```
393-
394209
### ExceptionAsserts
395210

396211
#### `willSeeException()`

0 commit comments

Comments
 (0)