tests: Fix "...Class "Chill\MainBundle\Security\Resolver\CenterResolverDispatcher" is declared "final" and cannot be mocked....".

This commit is contained in:
Pol Dellaiera
2021-11-23 12:13:47 +01:00
parent 45063fa6fe
commit 70ed9e75db
15 changed files with 80 additions and 82 deletions

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Chill\TaskBundle\Controller;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
use Chill\PersonBundle\Privacy\PrivacyEvent;
@@ -36,14 +36,14 @@ final class SingleTaskController extends AbstractController
private EventDispatcherInterface $eventDispatcher;
private TimelineBuilder $timelineBuilder;
private LoggerInterface $logger;
private CenterResolverDispatcher $centerResolverDispatcher;
private CenterResolverDispatcherInterface $centerResolverDispatcher;
private TranslatorInterface $translator;
private PaginatorFactory $paginatorFactory;
private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository;
private FilterOrderHelperFactoryInterface $filterOrderHelperFactory;
public function __construct(
CenterResolverDispatcher $centerResolverDispatcher,
CenterResolverDispatcherInterface $centerResolverDispatcher,
PaginatorFactory $paginatorFactory,
SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository,
TranslatorInterface $translator,

View File

@@ -4,14 +4,13 @@ declare(strict_types=1);
namespace Chill\TaskBundle\Form;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
use Chill\TaskBundle\Security\Authorization\TaskVoter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Entity\Center;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Chill\MainBundle\Form\Type\UserPickerType;
use Chill\MainBundle\Form\Type\ScopePickerType;
@@ -23,11 +22,14 @@ use Chill\MainBundle\Form\Type\ChillTextareaType;
class SingleTaskType extends AbstractType
{
private ParameterBagInterface $parameterBag;
private CenterResolverDispatcher $centerResolverDispatcher;
private CenterResolverDispatcherInterface $centerResolverDispatcher;
private ScopeResolverDispatcher $scopeResolverDispatcher;
public function __construct(ParameterBagInterface $parameterBag, CenterResolverDispatcher $centerResolverDispatcher, ScopeResolverDispatcher $scopeResolverDispatcher)
{
public function __construct(
ParameterBagInterface $parameterBag,
CenterResolverDispatcherInterface $centerResolverDispatcher,
ScopeResolverDispatcher $scopeResolverDispatcher
) {
$this->parameterBag = $parameterBag;
$this->centerResolverDispatcher = $centerResolverDispatcher;
$this->scopeResolverDispatcher = $scopeResolverDispatcher;

View File

@@ -1,9 +1,11 @@
<?php
declare(strict_types=1);
namespace Chill\TaskBundle\Repository;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\TaskBundle\Entity\SingleTask;
@@ -17,10 +19,10 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
private AuthorizationHelperInterface $authorizationHelper;
private EntityManagerInterface $em;
private Security $security;
private CenterResolverDispatcher $centerResolverDispatcher;
private CenterResolverDispatcherInterface $centerResolverDispatcher;
public function __construct(
CenterResolverDispatcher $centerResolverDispatcher,
CenterResolverDispatcherInterface $centerResolverDispatcher,
EntityManagerInterface $em,
Security $security,
AuthorizationHelperInterface $authorizationHelper