예제 #1
0
 /**
  * Tests the processRow method with an empty pipeline.
  */
 public function testProcessRowEmptyPipeline()
 {
     $this->migration->expects($this->once())->method('getProcessPlugins')->with(NULL)->will($this->returnValue(array('test' => array())));
     $row = new Row(array(), array());
     $this->executable->processRow($row);
     $this->assertSame($row->getDestination(), array());
 }
 /**
  * Tests the walk process plugin with multiple values.
  */
 public function testWalkWithMultipleValues()
 {
     // Set source value.
     $source_value = ['FOO', 'BAR', 'foobar'];
     // Set expected value;
     $expected_value = ['*Foo (mapped)*', '*Bar*', '*123*'];
     // Manually create the plugins. Migration::getProcessPlugins does this
     // normally, but the plugin system is not available.
     $process_plugins = $this->getProcessPlugins();
     // Define the value of getProcessPlugin() for every time processRow() is
     // called (number of values). See the count of $source_value.
     foreach (range(1, count($source_value)) as $key) {
         $this->migration->expects($this->at($key))->method('getProcessPlugins')->will($this->returnValue($process_plugins));
     }
     // Get migrate executable.
     $migrate_executable = $this->getMigrateExecutable();
     // Assert the value after running the process plugins.
     $plugin = new Walk($this->getWalkProcessPluginConfiguration(), 'walk', []);
     $new_value = $plugin->transform($source_value, $migrate_executable, new Row([], []), 'test');
     $this->assertSame($new_value, $expected_value);
 }