コード例 #1
0
 /**
  * @dataProvider submitDataProvider
  * @param mixed $submitData
  * @param mixed $formData
  * @param array $formOptions
  */
 public function testSubmit($submitData, $formData, array $formOptions)
 {
     $this->processorRegistry->expects($this->any())->method('getProcessorAliasesByEntity')->will($this->returnCallback(function ($type, $entityName) {
         \PHPUnit_Framework_Assert::assertEquals(ProcessorRegistry::TYPE_IMPORT, $type);
         return array($type . $entityName);
     }));
     $form = $this->factory->create($this->type, null, $formOptions);
     $this->assertTrue($form->has('file'));
     $this->assertEquals('file', $form->get('file')->getConfig()->getType()->getName());
     $this->assertTrue($form->get('file')->getConfig()->getOption('required'));
     $this->assertTrue($form->has('processorAlias'));
     $this->assertEquals('choice', $form->get('processorAlias')->getConfig()->getType()->getName());
     $this->assertTrue($form->get('processorAlias')->getConfig()->getOption('required'));
     $key = ProcessorRegistry::TYPE_IMPORT . $formOptions['entityName'];
     $this->assertEquals(array($key => 'oro.importexport.import.' . $key), $form->get('processorAlias')->getConfig()->getOption('choices'));
     $this->assertEquals(array('oro.importexport.import.' . $key), $form->get('processorAlias')->getConfig()->getOption('preferred_choices'));
     $form->submit($submitData);
     $this->assertTrue($form->isSynchronized());
     $this->assertEquals($formData, $form->getData());
 }
コード例 #2
0
 public function assertProcessCalls()
 {
     $this->logger->expects($this->any())->method('critical')->with($this->equalTo(''));
     $this->logger->expects($this->never())->method('critical');
     $this->processorRegistry->expects($this->any())->method('getProcessorAliasesByEntity')->will($this->returnValue([]));
 }