@@ -74,7 +74,6 @@ Laravel-specific Testing Helpers and Assertions.
74
74
- [emulateLocal](# emulatelocal)
75
75
- [emulateProduction](# emulateproduction)
76
76
- [emulateEnvironment](# emulateenvironment)
77
- - [isTravis](# istravis)
78
77
79
78
# # Available assertions
80
79
@@ -88,21 +87,6 @@ Laravel-specific Testing Helpers and Assertions.
88
87
- [assertDatabaseMissingTable](# assertdatabasemissingtable)
89
88
- [assertDatabaseHasMany](# assertdatabasehasmany)
90
89
- [assertDatabaseMissingMany](# assertdatabasemissingmany)
91
- - [EloquentAsserts](# eloquentasserts)
92
- - [assertEloquentTableEquals](# asserteloquenttableequals)
93
- - [assertEloquentTableNotEquals](# asserteloquenttablenotequals)
94
- - [assertEloquentIsIncrementing](# asserteloquentisincrementing)
95
- - [assertEloquentIsNotIncrementing](# asserteloquentisnotincrementing)
96
- - [assertEloquentFillableEquals](# asserteloquentfillableequals)
97
- - [assertEloquentFillableNotEquals](# asserteloquentfillablenotequals)
98
- - [assertEloquentDatesEquals](# asserteloquentdatesequals)
99
- - [assertEloquentDatesNotEquals](# asserteloquentdatesnotequals)
100
- - [assertEloquentTouchesEquals](# asserteloquenttouchesequals)
101
- - [assertEloquentTouchesNotEquals](# asserteloquenttouchesnotequals)
102
- - [assertEloquentHasMany](# asserteloquenthasmany)
103
- - [assertEloquentHasCreateFor](# asserteloquenthascreatefor)
104
- - [assertEloquentHasCreateManyFor](# asserteloquenthascreatemanyfor)
105
- - [assertEloquentBelongsTo](# asserteloquentbelongsto)
106
90
- [ExceptionAsserts](# exceptionasserts)
107
91
- [willSeeException](# willseeexception)
108
92
- [FilesystemAsserts](# filesystemasserts)
@@ -161,16 +145,6 @@ Emulate that application is running on the given environment:
161
145
$this -> emulateEnvironment(' demo' );
162
146
` ` `
163
147
164
- # ### `isTravis()`
165
-
166
- Check whether the application is running on Travis or not:
167
-
168
- ` ` ` php
169
- $this->isTravis ();
170
-
171
- // true
172
- ` ` `
173
-
174
148
# # Assertions
175
149
176
150
# ## CollectionAsserts
@@ -232,176 +206,6 @@ $this->assertDatabaseMissingMany('posts', [
232
206
]);
233
207
` ` `
234
208
235
- # ## EloquentAsserts
236
-
237
- # ### `assertEloquentTableEquals()`
238
-
239
- Assert that the model' s table name equals to the given value:
240
-
241
- ```php
242
- $this->assertEloquentTableEquals(User::class, ' users' );
243
- ```
244
-
245
- #### `assertEloquentTableNotEquals()`
246
-
247
- Assert that the model' s table name doesn' t equal to the given value:
248
-
249
- ```php
250
- $this->assertEloquentTableNotEquals(User::class, ' posts' );
251
- ```
252
-
253
- #### `assertEloquentIsIncrementing()`
254
-
255
- Assert that the model' s primary key is incrementing:
256
-
257
- ` ` ` php
258
- $this -> assertEloquentIsIncrementing(Post::class);
259
- ` ` `
260
-
261
- # ### `assertEloquentIsNotIncrementing()`
262
-
263
- Assert that the model' s primary key is not incrementing:
264
-
265
- ```php
266
- $this->assertEloquentIsNotIncrementing(Category::class);
267
- ```
268
-
269
- #### `assertEloquentFillableEquals()`
270
-
271
- Assert that the model' s ` fillable` field equals to the given value:
272
-
273
- ` ` ` php
274
- $this -> assertEloquentFillableEquals(Post::class, [' title' , ' publish_at' ]);
275
- ` ` `
276
-
277
- # ### `assertEloquentFillableNotEquals()`
278
-
279
- Assert that the model' s `fillable` field doesn' t equal to the given value:
280
-
281
- ` ` ` php
282
- $this -> assertEloquentFillableNotEquals(Post::class, [' title' , ' body' , ' publish_at' ]);
283
- ` ` `
284
-
285
- # ### `assertEloquentDatesEquals()`
286
-
287
- Assert that the model' s `dates` field equals to the given value:
288
-
289
- ```php
290
- $this->assertEloquentDatesEquals(Post::class, [' publish_at' , ' created_at' , ' updated_at' ]);
291
- ```
292
-
293
- #### `assertEloquentDatesNotEquals()`
294
-
295
- Assert that the model' s ` dates` field doesn' t equal to the given value:
296
-
297
- ```php
298
- $this->assertEloquentDatesNotEquals(Post::class, [' publish_at' ]);
299
- ```
300
-
301
- #### `assertEloquentTouchesEquals()`
302
-
303
- Assert that the model' s ` touches` field equals to the given value:
304
-
305
- ` ` ` php
306
- $this -> assertEloquentTouchesEquals(Comment::class, [' post' ]);
307
- ` ` `
308
-
309
- # ### `assertEloquentTouchesNotEquals()`
310
-
311
- Assert that the model' s `touches` field doesn' t equal to the given value:
312
-
313
- ` ` ` php
314
- $this -> assertEloquentTouchesNotEquals(Comment::class, [' user' ]);
315
- ` ` `
316
-
317
- # ### `assertEloquentHasMany()`
318
-
319
- > NOTE: To use this assertion, you have to create model factories for both classes.
320
-
321
- Assert that the model has the given ` HasMany` relation:
322
-
323
- ` ` ` php
324
- $this -> assertEloquentHasMany(Post::class, ' comments' );
325
- ` ` `
326
-
327
- Assuming that ` Post` class has ` comments` relation:
328
-
329
- ` ` ` php
330
- class Post extends Model
331
- {
332
- public function comments()
333
- {
334
- return $this -> hasMany(Comment::class);
335
- }
336
- }
337
- ` ` `
338
-
339
- # ### `assertEloquentHasCreateFor()`
340
-
341
- > NOTE: To use this assertion, you have to create model factories for both classes.
342
-
343
- Assert that the model has ` create` method for the given ` HasMany` relation:
344
-
345
- ` ` ` php
346
- $this -> assertEloquentHasCreateFor(Post::class, ' comments' );
347
- ` ` `
348
-
349
- Assuming that ` Post` class has `createComment ()` method:
350
-
351
- ` ` ` php
352
- class Post extends Model
353
- {
354
- public function createComment(array $attributes )
355
- {
356
- return $this->comments ()-> create($attributes );
357
- }
358
- }
359
- ` ` `
360
-
361
- # ### `assertEloquentHasCreateManyFor()`
362
-
363
- > NOTE: To use this assertion, you have to create model factories for both classes.
364
-
365
- Assert that the model has ` createMany` method for the given ` HasMany` relation:
366
-
367
- ` ` ` php
368
- $this -> assertEloquentHasCreateManyFor(Post::class, ' comments' );
369
- ` ` `
370
-
371
- Assuming that ` Post` class has ` createManyComments()` method:
372
-
373
- ` ` ` php
374
- class Post extends Model
375
- {
376
- public function createManyComments(array $comments )
377
- {
378
- return $this->comments ()-> createMany($comments );
379
- }
380
- }
381
- ` ` `
382
-
383
- # ### `assertEloquentBelongsTo()`
384
-
385
- > NOTE: To use this assertion, you have to create model factories for both classes.
386
-
387
- Assert that the model has the given ` BelongsTo` relation:
388
-
389
- ` ` ` php
390
- $this -> assertEloquentBelongsTo(Comment::class, ' post' );
391
- ` ` `
392
-
393
- Assuming that ` Comment` class has ` post` relation:
394
-
395
- ` ` ` php
396
- class Comment extends Model
397
- {
398
- public function post()
399
- {
400
- return $this -> belongsTo(Post::class);
401
- }
402
- }
403
- ` ` `
404
-
405
209
# ## ExceptionAsserts
406
210
407
211
# ### `willSeeException()`
0 commit comments