/** * @dataProvider formDataProviderForPreSet * * @param Channel|null $formData * @param string $channelType */ public function testPreSet($formData, $channelType) { $events = $this->subscriber->getSubscribedEvents(); $this->assertArrayHasKey(FormEvents::PRE_SET_DATA, $events); $this->assertEquals($events[FormEvents::PRE_SET_DATA], 'preSet'); $form = $this->getMock('Symfony\\Component\\Form\\Test\\FormInterface'); $fieldMock = $this->getMock('Symfony\\Component\\Form\\Test\\FormInterface'); $configMock = $this->getMock('Symfony\\Component\\Form\\FormConfigInterface'); if ($formData) { $form->expects($this->any())->method('get')->will($this->returnValue($fieldMock)); $fieldMock->expects($this->any())->method('getConfig')->will($this->returnValue($configMock)); $formData->expects($this->exactly(5))->method('getChannelType')->will($this->returnValue($channelType)); $this->settingsProvider->expects($this->once())->method('getIntegrationType')->will($this->returnValue($channelType)); } $event = new FormEvent($form, $formData); $event->setData($formData); $this->subscriber->preSet($event); }