mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Fixed phpunit tests
This commit is contained in:
parent
d898ca736c
commit
5074e2beac
3 changed files with 4 additions and 5 deletions
|
@ -52,7 +52,6 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Omines\DataTablesBundle\DataTableFactory;
|
use Omines\DataTablesBundle\DataTableFactory;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
@ -77,7 +76,7 @@ abstract class BaseAdminController extends AbstractController
|
||||||
public function __construct(protected TranslatorInterface $translator, protected UserPasswordHasherInterface $passwordEncoder,
|
public function __construct(protected TranslatorInterface $translator, protected UserPasswordHasherInterface $passwordEncoder,
|
||||||
protected AttachmentSubmitHandler $attachmentSubmitHandler,
|
protected AttachmentSubmitHandler $attachmentSubmitHandler,
|
||||||
protected EventCommentHelper $commentHelper, protected HistoryHelper $historyHelper, protected TimeTravel $timeTravel,
|
protected EventCommentHelper $commentHelper, protected HistoryHelper $historyHelper, protected TimeTravel $timeTravel,
|
||||||
protected DataTableFactory $dataTableFactory, protected EventDispatcher|EventDispatcherInterface $eventDispatcher, protected LabelExampleElementsGenerator $barcodeExampleGenerator,
|
protected DataTableFactory $dataTableFactory, protected EventDispatcherInterface $eventDispatcher, protected LabelExampleElementsGenerator $barcodeExampleGenerator,
|
||||||
protected LabelGenerator $labelGenerator, protected EntityManagerInterface $entityManager)
|
protected LabelGenerator $labelGenerator, protected EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
if ('' === $this->entity_class || '' === $this->form_class || '' === $this->twig_template || '' === $this->route_base) {
|
if ('' === $this->entity_class || '' === $this->form_class || '' === $this->twig_template || '' === $this->route_base) {
|
||||||
|
|
|
@ -38,7 +38,6 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||||
|
@ -59,7 +58,7 @@ use Symfony\Component\Validator\Constraints\Length;
|
||||||
#[Route(path: '/user')]
|
#[Route(path: '/user')]
|
||||||
class UserSettingsController extends AbstractController
|
class UserSettingsController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(protected bool $demo_mode, protected EventDispatcher|EventDispatcherInterface $eventDispatcher)
|
public function __construct(protected bool $demo_mode, protected EventDispatcherInterface $eventDispatcher)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -477,7 +477,8 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
public function setElement(AttachmentContainingDBElement $element): self
|
public function setElement(AttachmentContainingDBElement $element): self
|
||||||
{
|
{
|
||||||
if (!$element instanceof AttachmentContainingDBElement) {
|
//Do not allow Rector to replace this check with a instanceof. It will not work!!
|
||||||
|
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS, true)) {
|
||||||
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue