Skip to content

Commit

Permalink
Add remaining fake method
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Jul 13, 2022
1 parent ddbb0ba commit f637622
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 13 additions & 0 deletions src/Models/UserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Myth\Auth\Models;

use CodeIgniter\Model;
use Faker\Generator;
use Myth\Auth\Authorization\GroupModel;
use Myth\Auth\Entities\User;

Expand Down Expand Up @@ -108,4 +109,16 @@ protected function addToGroup($data)

return $data;
}

/**
* Faked data for Fabricator.
*/
public function fake(Generator &$faker): User
{
return new User([
'email' => $faker->email,
'username' => $faker->userName,
'password' => bin2hex(random_bytes(16)),
]);
}
}
13 changes: 0 additions & 13 deletions src/Test/Fakers/UserFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@

namespace Myth\Auth\Test\Fakers;

use Faker\Generator;
use Myth\Auth\Entities\User;
use Myth\Auth\Models\UserModel;

class UserFaker extends UserModel
{
/**
* Faked data for Fabricator.
*/
public function fake(Generator &$faker): User
{
return new User([
'email' => $faker->email,
'username' => $faker->userName,
'password' => bin2hex(random_bytes(16)),
]);
}
}

0 comments on commit f637622

Please sign in to comment.