The Test Helper file contains functions that assist in testing your project.
This helper is loaded using the following code:
helper('test');
The following functions are available:
fake($model, array $overrides = null) | Parameters: |
|
|---|---|
| Returns: |
A random fake item created and added to the database by Fabricator |
| Return type: |
object|array |
Uses CodeIgniter\Test\Fabricator to create a random item and add it to the database.
Usage example:
public function testUserAccess()
{
$user = fake('App\Models\UserModel');
$this->assertTrue($this->userHasAccess($user));
}
© 2014–2020 British Columbia Institute of Technology
Licensed under the MIT License.
https://codeigniter.com/user_guide/helpers/test_helper.html