Пример #1
0
 protected function setUp()
 {
     $this->importProcessor = $this->getMockBuilder('Oro\\Bundle\\IntegrationBundle\\ImportExport\\Processor\\StepExecutionAwareImportProcessor')->disableOriginalConstructor()->getMock();
     $this->exportProcessor = $this->getMockBuilder('Oro\\Bundle\\IntegrationBundle\\ImportExport\\Processor\\StepExecutionAwareExportProcessor')->disableOriginalConstructor()->getMock();
     $this->importProcessor->expects($this->any())->method('process')->will($this->returnCallback(function ($item) {
         $keys = array_map(function ($key) {
             return Inflector::camelize($key);
         }, array_keys($item));
         return (object) array_combine($keys, array_values($item));
     }));
     $this->exportProcessor->expects($this->any())->method('process')->will($this->returnCallback(function ($item) {
         $item = (array) $item;
         $keys = array_map(function ($key) {
             return Inflector::tableize($key);
         }, array_keys($item));
         return array_combine($keys, array_values($item));
     }));
     $this->strategy = new TwoWaySyncStrategy($this->importProcessor, $this->exportProcessor);
 }
Пример #2
0
 /**
  * @param array $data
  * @return array
  */
 protected function normalize(array $data)
 {
     $object = $this->importProcessor->process($data);
     return $this->exportProcessor->process($object);
 }
 public function testSetStepExecution()
 {
     $this->processor->setContextRegistry($this->contextRegistry);
     $this->contextRegistry->expects($this->once())->method('getByStepExecution')->will($this->returnValue($this->context));
     $this->processor->setStepExecution($this->stepExecution);
 }