function MigrateExecutableTest::getMockSource
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::getMockSource()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::getMockSource()
- 11.x core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php \Drupal\Tests\migrate\Unit\MigrateExecutableTest::getMockSource()
Returns a mock migration source instance.
Return value
\Drupal\migrate\Plugin\MigrateSourceInterface|\PHPUnit\Framework\MockObject\MockObject The mocked migration source.
6 calls to MigrateExecutableTest::getMockSource()
- MigrateExecutableTest::testImportWithValidRow in core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php - Tests the import method with a valid row.
- MigrateExecutableTest::testImportWithValidRowNoDestinationValues in core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php - Tests the import method with a valid row.
- MigrateExecutableTest::testImportWithValidRowWithDestinationMigrateException in core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php - Tests the import method with a thrown MigrateException.
- MigrateExecutableTest::testImportWithValidRowWithException in core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php - Tests the import method with a regular Exception being thrown.
- MigrateExecutableTest::testImportWithValidRowWithoutDestinationId in core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php - Tests the import method with a valid row.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateExecutableTest.php, line 442
Class
- MigrateExecutableTest
- @coversDefaultClass \Drupal\migrate\MigrateExecutable @group migrate
Namespace
Drupal\Tests\migrate\UnitCode
protected function getMockSource() {
$this->createMock('\\Iterator');
$class = 'Drupal\\migrate\\Plugin\\migrate\\source\\SourcePluginBase';
$source = $this->getMockBuilder($class)
->disableOriginalConstructor()
->onlyMethods(get_class_methods($class))
->getMockForAbstractClass();
$source->expects($this->once())
->method('rewind')
->willReturn(TRUE);
$source->expects($this->any())
->method('initializeIterator')
->willReturn([]);
$source->expects($this->any())
->method('valid')
->willReturn(TRUE, FALSE);
return $source;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.