Skip to content
Permalink
Browse files

tests: Fixed container get method calls.

  • Loading branch information...
tarlepp committed Jun 23, 2019
1 parent 9f9134d commit 23a0c81d5a31f1166bed6b1058dad3fc7a31cd47
@@ -11,12 +11,12 @@
use App\Entity\ApiKey;
use App\Entity\UserGroup;
use App\Security\RolesServiceInterface;
use BadMethodCallException;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Throwable;
use function array_map;
use function str_pad;
@@ -60,18 +60,14 @@ public function setContainer(?ContainerInterface $container = null): void
*
* @param ObjectManager $manager
*
* @throws BadMethodCallException
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
* @throws Throwable
*/
public function load(ObjectManager $manager): void
{
/** @var RolesServiceInterface $roles */
$roles = $this->container->get('test.App\Security\RolesService');
/** @var RolesServiceInterface $rolesService */
$rolesService = $this->container->get('test.app.security.roles_service');
$this->roles = $roles;
$this->roles = $rolesService;
$this->manager = $manager;
// Create entities
@@ -98,7 +94,7 @@ public function getOrder(): int
*
* @param string|null $role
*
* @throws BadMethodCallException
* @throws Throwable
*/
private function createApiKey(?string $role = null): void
{
@@ -57,19 +57,13 @@ public function setContainer(?ContainerInterface $container = null): void
* Load data fixtures with the passed EntityManager
*
* @param ObjectManager $manager
*
* @throws BadMethodCallException
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
*/
public function load(ObjectManager $manager): void
{
/** @var RolesServiceInterface $roles */
$roles = $this->container->get('test.App\Security\RolesService');
/** @var RolesServiceInterface $rolesService */
$rolesService = $this->container->get('test.app.security.roles_service');
$this->roles = $roles;
$this->roles = $rolesService;
$this->manager = $manager;
$iterator = function (string $role): void {
@@ -11,12 +11,12 @@
use App\Entity\User;
use App\Entity\UserGroup;
use App\Security\RolesServiceInterface;
use BadMethodCallException;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Throwable;
use function array_map;
/**
@@ -59,18 +59,14 @@ public function setContainer(?ContainerInterface $container = null): void
*
* @param ObjectManager $manager
*
* @throws BadMethodCallException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
* @throws Throwable
*/
public function load(ObjectManager $manager): void
{
/** @var RolesServiceInterface $roles */
$roles = $this->container->get('test.App\Security\RolesService');
/** @var RolesServiceInterface $rolesService */
$rolesService = $this->container->get('test.app.security.roles_service');
$this->roles = $roles;
$this->roles = $rolesService;
$this->manager = $manager;
// Create entities
@@ -97,7 +93,7 @@ public function getOrder(): int
*
* @param string|null $role
*
* @throws BadMethodCallException
* @throws Throwable
*/
private function createUser(?string $role = null): void
{
@@ -11,12 +11,12 @@
use App\Entity\Role;
use App\Entity\UserGroup;
use App\Security\RolesServiceInterface;
use BadMethodCallException;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Throwable;
use function array_map;
/**
@@ -59,18 +59,14 @@ public function setContainer(?ContainerInterface $container = null): void
*
* @param ObjectManager $manager
*
* @throws BadMethodCallException
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
* @throws Throwable
*/
public function load(ObjectManager $manager): void
{
/** @var RolesServiceInterface $roles */
$roles = $this->container->get('test.App\Security\RolesService');
/** @var RolesServiceInterface $rolesService */
$rolesService = $this->container->get('test.app.security.roles_service');
$this->roles = $roles;
$this->roles = $rolesService;
$this->manager = $manager;
$iterator = function (string $role): void {
@@ -99,7 +95,7 @@ public function getOrder(): int
*
* @param string $role
*
* @throws BadMethodCallException
* @throws Throwable
*/
private function createUserGroup(string $role): void
{
@@ -59,7 +59,7 @@ protected function setUp(): void
self::bootKernel();
/** @var Auth $authService */
$authService = self::$container->get('test.App\Utils\Tests\Auth');
$authService = self::$container->get('test.app.utils.tests.auth');
$this->authService = $authService;
}

0 comments on commit 23a0c81

Please sign in to comment.
You can’t perform that action at this time.