B
B
BonBon Slick2018-09-28 19:23:56
Unit testing
BonBon Slick, 2018-09-28 19:23:56

Is it possible to test a class normally when it has more than 20 dependencies in the constructor?

$this->entityManager = $entityManager;
        $this->userRepository = $userRepository;
        $this->mailService = $mailService;
        $this->tokenStorage = $tokenStorage;
        $this->session = $session;
        $this->logger = $logger;
        $this->tokenManager = $tokenManager;
        $this->userFactory = $userFactory;
        $this->profileScoreManager = $profileScoreManager;
        $this->googleTagManager = $googleTagManager;
        $this->trackingDataFactory = $trackingDataFactory;
        $this->typeaheadManager = $typeaheadManager;
        $this->requestStack = $requestStack;
        $this->messageManager = $messageManager;
        $this->userChecker = $userChecker;
...

And how to test this, there are too many mocks.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question