Commit d11cc0aa authored by alexpott's avatar alexpott

Issue #2808329 by quietone, phenaproxima: Add default values to Row constructor

parent 01ed544c
......@@ -70,7 +70,7 @@ public function testTemporary() {
protected function doTransform(array $value) {
$executable = new MigrateExecutable($this->getMigration(), new MigrateMessage());
$row = new Row([], []);
$row = new Row();
return (new FileUri([], 'file_uri', []))
->transform($value, $executable, $row, 'foobaz');
......
......@@ -71,7 +71,7 @@ public function test($value, $expected_value, $invalid_id = NULL) {
);
}
$row = new Row([], []);
$row = new Row();
$output_value = $plugin->transform($value, $this->executable, $row, 'foo');
$this->assertSame($expected_value, $output_value);
......
......@@ -91,7 +91,7 @@ class Row {
* @throws \InvalidArgumentException
* Thrown when a source ID property does not exist.
*/
public function __construct(array $values, array $source_ids, $is_stub = FALSE) {
public function __construct(array $values = [], array $source_ids = [], $is_stub = FALSE) {
$this->source = $values;
$this->sourceIds = $source_ids;
$this->isStub = $is_stub;
......
......@@ -123,7 +123,7 @@ public function testTranslated() {
// Import some rows.
foreach ($destination_rows as $idx => $destination_row) {
$row = new Row([], []);
$row = new Row();
foreach ($destination_row as $key => $value) {
$row->setDestinationProperty($key, $value);
}
......
......@@ -172,7 +172,7 @@ public function testRenameFile() {
protected function doImport($source_path, $destination_path, $configuration = []) {
$plugin = FileCopy::create($this->container, $configuration, 'file_copy', []);
$executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
$row = new Row([], []);
$row = new Row();
$result = $plugin->transform([$source_path, $destination_path], $executable, $row, 'foobaz');
......
......@@ -398,7 +398,7 @@ public function testProcessRow() {
->method('getProcessPlugins')
->with(NULL)
->will($this->returnValue($plugins));
$row = new Row(array(), array());
$row = new Row();
$this->executable->processRow($row);
foreach ($expected as $key => $value) {
$this->assertSame($row->getDestinationProperty($key), $value);
......@@ -414,7 +414,7 @@ public function testProcessRowEmptyPipeline() {
->method('getProcessPlugins')
->with(NULL)
->will($this->returnValue(array('test' => array())));
$row = new Row(array(), array());
$row = new Row();
$this->executable->processRow($row);
$this->assertSame($row->getDestination(), array());
}
......
......@@ -286,7 +286,7 @@ public function testPrepareRow() {
// Get a new migration with an id.
$migration = $this->getMigration();
$source = new StubSourcePlugin([], '', [], $migration);
$row = new Row([], []);
$row = new Row();
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
$module_handler->invokeAll('migrate_prepare_row', [$row, $source, $migration])
......@@ -328,7 +328,7 @@ public function testPrepareRowGlobalPrepareSkip() {
$migration = $this->getMigration();
$source = new StubSourcePlugin([], '', [], $migration);
$row = new Row([], []);
$row = new Row();
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
// Return a failure from a prepare row hook.
......@@ -357,7 +357,7 @@ public function testPrepareRowMigratePrepareSkip() {
$migration = $this->getMigration();
$source = new StubSourcePlugin([], '', [], $migration);
$row = new Row([], []);
$row = new Row();
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
// Return a failure from a prepare row hook.
......@@ -386,7 +386,7 @@ public function testPrepareRowPrepareException() {
$migration = $this->getMigration();
$source = new StubSourcePlugin([], '', [], $migration);
$row = new Row([], []);
$row = new Row();
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
// Return a failure from a prepare row hook.
......
......@@ -74,7 +74,7 @@ public function testImport() {
->willReturn(5);
$destination->setEntity($entity->reveal());
// Ensure the id is saved entity id is returned from import.
$this->assertEquals([5], $destination->import(new Row([], [])));
$this->assertEquals([5], $destination->import(new Row()));
// Assert that import set the rollback action.
$this->assertEquals(MigrateIdMapInterface::ROLLBACK_DELETE, $destination->rollbackAction());
}
......@@ -95,7 +95,7 @@ public function testImportEntityLoadFailure() {
$this->entityManager->reveal(),
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
$destination->setEntity(FALSE);
$destination->import(new Row([], []));
$destination->import(new Row());
}
/**
......
......@@ -49,7 +49,7 @@ class RowTest extends UnitTestCase {
* Tests object creation: empty.
*/
public function testRowWithoutData() {
$row = new Row(array(), array());
$row = new Row();
$this->assertSame(array(), $row->getSource(), 'Empty row');
}
......
......@@ -67,7 +67,7 @@ public function testGetEntityDestinationValues() {
$this->storage->loadRevision(12)
->shouldBeCalled()
->willReturn($entity->reveal());
$row = new Row([], []);
$row = new Row();
$this->assertEquals($entity->reveal(), $destination->getEntity($row, [12, 13]));
}
......
......@@ -29,7 +29,7 @@ public function testImport() {
'field_name' => 'field_name_test',
'options' => array('test setting'),
);
$row = new Row(array(), array());
$row = new Row();
foreach ($values as $key => $value) {
$row->setDestinationProperty($key, $value);
}
......
......@@ -29,7 +29,7 @@ public function testImport() {
'field_name' => 'field_name_test',
'options' => array('test setting'),
);
$row = new Row(array(), array());
$row = new Row();
foreach ($values as $key => $value) {
$row->setDestinationProperty($key, $value);
}
......
......@@ -67,7 +67,7 @@ public function testIterator() {
),
);
// This is not used but the interface requires it, so create an empty row.
$row = new Row(array(), array());
$row = new Row();
// After transformation, check to make sure that source_foo and source_id's
// values ended up in the proper destinations, and that the value of the
......
......@@ -57,7 +57,7 @@ public function testUrls($input, $output) {
*/
protected function doTransform($value) {
$executable = new MigrateExecutable($this->getMigration(), new MigrateMessage());
$row = new Row([], []);
$row = new Row();
return (new UrlEncode([], 'urlencode', []))
->transform($value, $executable, $row, 'foobaz');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment