-
Notifications
You must be signed in to change notification settings - Fork 58
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
5 changed files
with
70 additions
and
7 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
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
37 changes: 37 additions & 0 deletions
37
tests/Fixtures/AppTestBundle/DataFixtures/ORM/LoadAdminUsers.php
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,37 @@ | ||
<?php | ||
|
||
namespace AlterPHP\EasyAdminExtensionBundle\Tests\Fixtures\AppTestBundle\DataFixtures\ORM; | ||
|
||
use AppTestBundle\Entity\FunctionalTests\AdminUser; | ||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
class LoadAdminUsers extends AbstractFixture implements OrderedFixtureInterface | ||
{ | ||
public function getOrder() | ||
{ | ||
return 11; | ||
} | ||
|
||
public function load(ObjectManager $manager) | ||
{ | ||
foreach (range(1, 20) as $i) { | ||
$adminUser = new AdminUser(); | ||
$adminUser->updateFromData(array( | ||
'gSuiteId' => 'g-suite-id-'.$i, | ||
'email' => 'email-'.$i.'@easyadmin.com', | ||
'lastname' => 'lastname-'.$i, | ||
'firstname' => 'firstname-'.$i, | ||
)); | ||
|
||
// All users are members of first AdminGroup | ||
$adminUser->addGroup($this->getReference('admin-group-1')); | ||
|
||
$this->addReference('admin-user-'.$i, $adminUser); | ||
$manager->persist($adminUser); | ||
} | ||
|
||
$manager->flush(); | ||
} | ||
} |
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