protected function MigrateSqlSourceTestCase::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/tests/src/Unit/MigrateSqlSourceTestCase.php \Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase::setUp()
Overrides UnitTestCase::setUp
60 calls to MigrateSqlSourceTestCase::setUp()
- ActionTest::setUp in core/
modules/ action/ tests/ src/ Unit/ Plugin/ migrate/ source/ d6/ ActionTest.php - AggregatorFeedTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ d6/ AggregatorFeedTest.php - AggregatorFeedTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ d7/ AggregatorFeedTest.php - AggregatorItemTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ AggregatorItemTest.php - BlockCustomTest::setUp in core/
modules/ block_content/ tests/ src/ Unit/ Plugin/ migrate/ source/ d7/ BlockCustomTest.php
61 methods override MigrateSqlSourceTestCase::setUp()
- ActionTest::setUp in core/
modules/ action/ tests/ src/ Unit/ Plugin/ migrate/ source/ d6/ ActionTest.php - AggregatorFeedTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ d6/ AggregatorFeedTest.php - AggregatorFeedTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ d7/ AggregatorFeedTest.php - AggregatorItemTest::setUp in core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ migrate/ source/ AggregatorItemTest.php - BlockCustomTest::setUp in core/
modules/ block_content/ tests/ src/ Unit/ Plugin/ migrate/ source/ d7/ BlockCustomTest.php
File
- core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlSourceTestCase.php, line 80 - Contains \Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase.
Class
- MigrateSqlSourceTestCase
- Base class for Migrate module source unit tests.
Namespace
Drupal\Tests\migrate\UnitCode
protected function setUp() {
$module_handler = $this
->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$state = $this
->getMock('Drupal\\Core\\State\\StateInterface');
$entity_manager = $this
->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$migration = $this
->getMigration();
$migration
->expects($this
->any())
->method('getHighWater')
->will($this
->returnValue(static::ORIGINAL_HIGH_WATER));
// Setup the plugin.
$plugin_class = static::PLUGIN_CLASS;
$plugin = new $plugin_class($this->migrationConfiguration['source'], $this->migrationConfiguration['source']['plugin'], array(), $migration, $state, $entity_manager);
// Do some reflection to set the database and moduleHandler.
$plugin_reflection = new \ReflectionClass($plugin);
$database_property = $plugin_reflection
->getProperty('database');
$database_property
->setAccessible(TRUE);
$module_handler_property = $plugin_reflection
->getProperty('moduleHandler');
$module_handler_property
->setAccessible(TRUE);
// Set the database and the module handler onto our plugin.
$database_property
->setValue($plugin, $this
->getDatabase($this->databaseContents + array(
'test_map' => array(),
)));
$module_handler_property
->setValue($plugin, $module_handler);
$plugin
->setStringTranslation($this
->getStringTranslationStub());
$migration
->expects($this
->any())
->method('getSourcePlugin')
->will($this
->returnValue($plugin));
$this->source = $plugin;
$this->expectedCount = count($this->expectedResults);
}