-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test database; added user and client fixtures; added client ind…
…ex and client creation tests
- Loading branch information
Showing
15 changed files
with
266 additions
and
61 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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.idea | ||
app/var/* | ||
app/vendor/* | ||
!db | ||
db/* | ||
!app/public | ||
app/public/* | ||
db_test |
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 |
---|---|---|
|
@@ -27,8 +27,8 @@ APP_SECRET=ccd80113c9ecc72e222101920ae5aa0a | |
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml | ||
# | ||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7" | ||
DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
DATABASE_URL="mysql://lux_admin:&pHDG3%LcV@database:3306/lux?serverVersion=8.0" | ||
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
###> symfony/lock ### | ||
|
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php // test.AKISMET_KEY.ca01fb on Tue, 29 Mar 2022 12:35:58 +0000 | ||
|
||
return "\x2C\xAE\x2AX\x3F\x90\x93\x18\x15\x20\x01\x02\xE1r\xADA\xF4\x3A\xDC\xAF\x7C\x20\xD2\x89V\xE7\x06\x7Dn\x9C\x5Da\x88_\x01\xDB\xD9\x96w\x5Ej\xAB\xA5s\x8C\xD8\x8BTB\x80\xAF\x86q\xB14\x03G"; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php // test.decrypt.private on Tue, 29 Mar 2022 12:35:57 +0000 | ||
|
||
return "\x86\xF8\x3Bz\xBB9\x3F\x10\x8F\x1C\x96\xF3\xD8\x84\xAFW\x18\xE6_X\x85\x86\x85\x9EZ\x3AJ.\x8B\xE5\x98\xEA\x11\x80\xA8\xECL\x5E\x3C\x1A\xF1O\x9E\xD7\xBC\xBEw\xFC\x25\x0C\xC9d\xF6\x2Ad\xF1g\xD9\x12\xA4R\x0F\x29t"; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php // test.encrypt.public on Tue, 29 Mar 2022 12:35:57 +0000 | ||
|
||
return "\x11\x80\xA8\xECL\x5E\x3C\x1A\xF1O\x9E\xD7\xBC\xBEw\xFC\x25\x0C\xC9d\xF6\x2Ad\xF1g\xD9\x12\xA4R\x0F\x29t"; |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'AKISMET_KEY' => null, | ||
]; |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,39 +4,30 @@ | |
|
||
use App\Entity\User; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\ORM\EntityManager; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; | ||
use Doctrine\Persistence\ObjectManager; | ||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||
|
||
class UserFixtures extends Fixture | ||
{ | ||
private $encoder; | ||
private $em; | ||
public const USER_REFERENCE = 'user'; | ||
private UserPasswordHasherInterface $hasher; | ||
|
||
public function __construct(UserPasswordEncoderInterface $encoder, EntityManagerInterface $entityManager) | ||
public function __construct(UserPasswordHasherInterface $hasher, EntityManagerInterface $entityManager) | ||
{ | ||
$this->encoder = $encoder; | ||
$this->em = $entityManager; | ||
$this->hasher = $hasher; | ||
} | ||
|
||
public function load(\Doctrine\Persistence\ObjectManager $manager) | ||
public function load(ObjectManager $manager) | ||
{ | ||
$usersData = [ | ||
0 => [ | ||
'email' => '[email protected]', | ||
'role' => ['ROLE_USER'], | ||
'password' => 123456 | ||
] | ||
]; | ||
$user = new User(); | ||
$user->setEmail('[email protected]'); | ||
$user->setPassword($this->hasher->hashPassword($user, 'qwerty123456')); | ||
$user->setRoles(['ROLE_USER']); | ||
|
||
$manager->persist($user); | ||
$manager->flush(); | ||
|
||
foreach ($usersData as $user) { | ||
$newUser = new User(); | ||
$newUser->setEmail($user['email']); | ||
$newUser->setPassword($this->encoder->encodePassword($newUser, $user['password'])); | ||
$newUser->setRoles($user['role']); | ||
$this->em->persist($newUser); | ||
} | ||
|
||
$this->em->flush(); | ||
$this->addReference(self::USER_REFERENCE, $user); | ||
} | ||
} |
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
Oops, something went wrong.