formModel = $this->createMock(FormModel::class); $this->trackableModel = $this->createMock(TrackableModel::class); $this->twig = $this->createMock(Environment::class); $this->dispatcher = $this->createMock(EventDispatcherInterface::class); $this->leadFieldModel = $this->createMock(FieldModel::class); $this->contactTracker = $this->createMock(ContactTracker::class); parent::setUp(); } /** * @dataProvider focusTypeProvider */ public function testGetContentWithForm(string $type, InvokedCount $count): void { $this->formModel->expects(self::once())->method('getPages')->willReturn(['', '']); $this->formModel->expects($count)->method('getEntity'); $focusModel = new FocusModel( $this->formModel, $this->trackableModel, $this->twig, $this->leadFieldModel, $this->contactTracker, $this->createMock(EntityManagerInterface::class), $this->createMock(CorePermissions::class), $this->dispatcher, $this->createMock(UrlGeneratorInterface::class), $this->createMock(Translator::class), $this->createMock(UserHelper::class), $this->createMock(LoggerInterface::class), $this->createMock(CoreParametersHelper::class) ); $focus = [ 'form' => 'xxx', 'type' => $type, ]; $focusModel->getContent($focus); } public function focusTypeProvider(): \Generator { yield ['form', self::once()]; yield ['notice', self::never()]; } }