PHP code example of ez-php / testing

1. Go to this page and download the library: Download ez-php/testing library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ez-php / testing example snippets


use EzPhp\Testing\EntityFactory;

$factory = new EntityFactory(User::class, $userRepo, [
    'name'  => 'Alice',
    'email' => fn () => uniqid('user_') . '@example.com',
]);

$user  = $factory->make();             // not persisted
$user  = $factory->create();           // persisted via $userRepo->save()
$users = $factory->makeMany(3);
$users = $factory->createMany(5, ['role' => 'admin']);
bash
composer