comparison core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
93 $row->expects($this->once()) 93 $row->expects($this->once())
94 ->method('getSourceIdValues') 94 ->method('getSourceIdValues')
95 ->will($this->returnValue(['id' => 'test'])); 95 ->will($this->returnValue(['id' => 'test']));
96 96
97 $this->idMap->expects($this->once()) 97 $this->idMap->expects($this->once())
98 ->method('lookupDestinationId') 98 ->method('lookupDestinationIds')
99 ->with(['id' => 'test']) 99 ->with(['id' => 'test'])
100 ->will($this->returnValue(['test'])); 100 ->will($this->returnValue([['test']]));
101 101
102 $source->expects($this->once()) 102 $source->expects($this->once())
103 ->method('current') 103 ->method('current')
104 ->will($this->returnValue($row)); 104 ->will($this->returnValue($row));
105 105
135 $row->expects($this->once()) 135 $row->expects($this->once())
136 ->method('getSourceIdValues') 136 ->method('getSourceIdValues')
137 ->will($this->returnValue(['id' => 'test'])); 137 ->will($this->returnValue(['id' => 'test']));
138 138
139 $this->idMap->expects($this->once()) 139 $this->idMap->expects($this->once())
140 ->method('lookupDestinationId') 140 ->method('lookupDestinationIds')
141 ->with(['id' => 'test']) 141 ->with(['id' => 'test'])
142 ->will($this->returnValue(['test'])); 142 ->will($this->returnValue([['test']]));
143 143
144 $source->expects($this->once()) 144 $source->expects($this->once())
145 ->method('current') 145 ->method('current')
146 ->will($this->returnValue($row)); 146 ->will($this->returnValue($row));
147 147
211 211
212 $this->idMap->expects($this->once()) 212 $this->idMap->expects($this->once())
213 ->method('saveMessage'); 213 ->method('saveMessage');
214 214
215 $this->idMap->expects($this->once()) 215 $this->idMap->expects($this->once())
216 ->method('lookupDestinationId') 216 ->method('lookupDestinationIds')
217 ->with(['id' => 'test']) 217 ->with(['id' => 'test'])
218 ->will($this->returnValue(['test'])); 218 ->will($this->returnValue([['test']]));
219 219
220 $this->message->expects($this->once()) 220 $this->message->expects($this->once())
221 ->method('display') 221 ->method('display')
222 ->with('New object was not saved, no error provided'); 222 ->with('New object was not saved, no error provided');
223 223
267 267
268 $this->idMap->expects($this->once()) 268 $this->idMap->expects($this->once())
269 ->method('saveMessage'); 269 ->method('saveMessage');
270 270
271 $this->idMap->expects($this->once()) 271 $this->idMap->expects($this->once())
272 ->method('lookupDestinationId') 272 ->method('lookupDestinationIds')
273 ->with(['id' => 'test']) 273 ->with(['id' => 'test'])
274 ->will($this->returnValue(['test'])); 274 ->will($this->returnValue([['test']]));
275 275
276 $this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import()); 276 $this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import());
277 } 277 }
278 278
279 /** 279 /**
317 317
318 $this->idMap->expects($this->once()) 318 $this->idMap->expects($this->once())
319 ->method('saveMessage'); 319 ->method('saveMessage');
320 320
321 $this->idMap->expects($this->never()) 321 $this->idMap->expects($this->never())
322 ->method('lookupDestinationId'); 322 ->method('lookupDestinationIds');
323 323
324 $this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import()); 324 $this->assertSame(MigrationInterface::RESULT_COMPLETED, $this->executable->import());
325 } 325 }
326 326
327 /** 327 /**
365 365
366 $this->idMap->expects($this->once()) 366 $this->idMap->expects($this->once())
367 ->method('saveMessage'); 367 ->method('saveMessage');
368 368
369 $this->idMap->expects($this->once()) 369 $this->idMap->expects($this->once())
370 ->method('lookupDestinationId') 370 ->method('lookupDestinationIds')
371 ->with(['id' => 'test']) 371 ->with(['id' => 'test'])
372 ->will($this->returnValue(['test'])); 372 ->will($this->returnValue([['test']]));
373 373
374 $this->message->expects($this->once()) 374 $this->message->expects($this->once())
375 ->method('display') 375 ->method('display')
376 ->with($exception_message); 376 ->with($exception_message);
377 377
382 * Tests the processRow method. 382 * Tests the processRow method.
383 */ 383 */
384 public function testProcessRow() { 384 public function testProcessRow() {
385 $expected = [ 385 $expected = [
386 'test' => 'test destination', 386 'test' => 'test destination',
387 'test1' => 'test1 destination' 387 'test1' => 'test1 destination',
388 ]; 388 ];
389 foreach ($expected as $key => $value) { 389 foreach ($expected as $key => $value) {
390 $plugins[$key][0] = $this->getMock('Drupal\migrate\Plugin\MigrateProcessInterface'); 390 $plugins[$key][0] = $this->getMock('Drupal\migrate\Plugin\MigrateProcessInterface');
391 $plugins[$key][0]->expects($this->once()) 391 $plugins[$key][0]->expects($this->once())
392 ->method('getPluginDefinition') 392 ->method('getPluginDefinition')