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

8.3.x
Alex Pott 2016-10-12 14:11:15 +01:00
parent 01ed544c7a
commit d11cc0aa41
14 changed files with 19 additions and 19 deletions

View File

@ -70,7 +70,7 @@ class FileUriTest extends MigrateTestCase {
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');

View File

@ -71,7 +71,7 @@ class FilterIdTest extends KernelTestBase {
);
}
$row = new Row([], []);
$row = new Row();
$output_value = $plugin->transform($value, $this->executable, $row, 'foo');
$this->assertSame($expected_value, $output_value);

View File

@ -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;

View File

@ -123,7 +123,7 @@ class MigrateEntityContentBaseTest extends KernelTestBase {
// 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);
}

View File

@ -172,7 +172,7 @@ class CopyFileTest extends FileTestBase {
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');

View File

@ -398,7 +398,7 @@ class MigrateExecutableTest extends MigrateTestCase {
->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 @@ class MigrateExecutableTest extends MigrateTestCase {
->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());
}

View File

@ -286,7 +286,7 @@ class MigrateSourceTest extends MigrateTestCase {
// 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 @@ class MigrateSourceTest extends MigrateTestCase {
$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 @@ class MigrateSourceTest extends MigrateTestCase {
$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 @@ class MigrateSourceTest extends MigrateTestCase {
$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.

View File

@ -74,7 +74,7 @@ class EntityContentBaseTest extends UnitTestCase {
->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 @@ class EntityContentBaseTest extends UnitTestCase {
$this->entityManager->reveal(),
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
$destination->setEntity(FALSE);
$destination->import(new Row([], []));
$destination->import(new Row());
}
/**

View File

@ -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');
}

View File

@ -67,7 +67,7 @@ class EntityRevisionTest extends UnitTestCase {
$this->storage->loadRevision(12)
->shouldBeCalled()
->willReturn($entity->reveal());
$row = new Row([], []);
$row = new Row();
$this->assertEquals($entity->reveal(), $destination->getEntity($row, [12, 13]));
}

View File

@ -29,7 +29,7 @@ class PerComponentEntityDisplayTest extends MigrateTestCase {
'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);
}

View File

@ -29,7 +29,7 @@ class PerComponentEntityFormDisplayTest extends MigrateTestCase {
'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);
}

View File

@ -67,7 +67,7 @@ class IteratorTest extends MigrateTestCase {
),
);
// 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

View File

@ -57,7 +57,7 @@ class UrlEncodeTest extends MigrateTestCase {
*/
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');