-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ | |
|
||
namespace CakeDC\Api\Test\Fixture; | ||
|
||
use Authentication\PasswordHasher\DefaultPasswordHasher; | ||
use Authentication\PasswordHasher\PasswordHasherFactory; | ||
use Cake\TestSuite\Fixture\TestFixture; | ||
use CakeDC\Users\Webauthn\Base64Utility; | ||
|
||
|
@@ -20,12 +22,20 @@ | |
*/ | ||
class UsersFixture extends TestFixture | ||
{ | ||
|
||
/** | ||
* records property | ||
* | ||
* @var array | ||
*/ | ||
public array $records = []; | ||
|
||
/** | ||
* Init method | ||
* | ||
* @return void | ||
*/ | ||
public function init(): void | ||
public function __construct() | ||
{ | ||
$this->records = [ | ||
[ | ||
|
@@ -42,20 +52,18 @@ public function init(): void | |
'secret' => 'yyy', | ||
'secret_verified' => false, | ||
'tos_date' => '2015-06-24 17:33:54', | ||
'active' => false, | ||
'active' => true, | ||
'is_superuser' => true, | ||
'role' => 'admin', | ||
'created' => '2015-06-24 17:33:54', | ||
'modified' => '2015-06-24 17:33:54', | ||
'additional_data' => null, | ||
'last_login' => '2015-06-24 17:33:54', | ||
], | ||
[ | ||
'id' => '00000000-0000-0000-0000-000000000002', | ||
'username' => 'user-2', | ||
'email' => '[email protected]', | ||
//The password real value is 12345 | ||
'password' => '$2y$10$Nvu7ipP.z8tiIl75OdUvt.86vuG6iKMoHIOc7O7mboFI85hSyTEde', | ||
'password' => '12345', | ||
'first_name' => 'user', | ||
'last_name' => 'second', | ||
'token' => '6614f65816754310a5f0553436dd89e9', | ||
|
@@ -212,28 +220,12 @@ public function init(): void | |
'created' => '2015-06-24 17:33:54', | ||
'modified' => '2015-06-24 17:33:54', | ||
], | ||
[ | ||
'id' => '00000000-0000-0000-0000-000000000010', | ||
'username' => 'Lorem ipsum dolor sit amet', | ||
'email' => 'Lorem ipsum dolor sit amet', | ||
'password' => 'Lorem ipsum dolor sit amet', | ||
'first_name' => 'Lorem ipsum dolor sit amet', | ||
'last_name' => 'Lorem ipsum dolor sit amet', | ||
'token' => 'Lorem ipsum dolor sit amet', | ||
'token_expires' => '2015-06-24 17:33:54', | ||
'api_token' => 'Lorem ipsum dolor sit amet', | ||
'activation_date' => '2015-06-24 17:33:54', | ||
'secret' => 'Lorem ipsum dolor sit amet', | ||
'secret_verified' => false, | ||
'tos_date' => '2015-06-24 17:33:54', | ||
'active' => true, | ||
'is_superuser' => false, | ||
'role' => 'Lorem ipsum dolor sit amet', | ||
'created' => '2015-06-24 17:33:54', | ||
'modified' => '2015-06-24 17:33:54', | ||
], | ||
]; | ||
|
||
parent::init(); | ||
parent::__construct(); | ||
$hasher = PasswordHasherFactory::build(DefaultPasswordHasher::class); | ||
foreach ($this->records as $id => $record) { | ||
$this->records[$id]['password'] = $hasher->hash($record['password']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters