Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 1.32 KB

queries.md

File metadata and controls

23 lines (16 loc) · 1.32 KB

Queries

The fixture factories are closely related to the database. The package provides several methods to conveniently run queries. All methods will by-pass the beforeFind event, enabling the direct inspection of your test database.

These methods are meant to help performing assertions in the "Assert" part of your tests. Do not use the ::find() method in the "Act" part of your tests, e.g. to test finders.

ArticleFactory::find()

This method will return a query on the table related to the given factory. It takes as input the same parameters as the classic table find() method. More documentation on the find method here.

ArticleFactory::count()

This method will return the number of entries in the table of the given factory.

ArticleFactory::get()

This method will return an entity based on its primary key. More documentation on the get method here.

ArticleFactory::firstOrFail($condition)

This method will return an entity based on the optional conditions passed as parameter. More documentation on the firstOrFail method here.