/** * Actually run the test. * * @param array $schema * The mock schema object with expectations set. The Sql constructor calls * ensureTables() which in turn calls this object and the expectations on * it are the actual test and there are no additional asserts added. */ protected function runEnsureTablesTest($schema) { $database = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock(); $database->expects($this->any())->method('schema')->will($this->returnValue($schema)); $migration = $this->getMigration(); $plugin = $this->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface'); $plugin->expects($this->any())->method('getIds')->will($this->returnValue(array('source_id_property' => array('type' => 'integer')))); $migration->expects($this->any())->method('getSourcePlugin')->will($this->returnValue($plugin)); $plugin = $this->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface'); $plugin->expects($this->any())->method('getIds')->will($this->returnValue(array('destination_id_property' => array('type' => 'string')))); $migration->expects($this->any())->method('getDestinationPlugin')->will($this->returnValue($plugin)); $map = new TestSqlIdMap($database, array(), 'sql', array(), $migration); $map->getDatabase(); }
/** * Actually run the test. * * @param array $schema * The mock schema object with expectations set. The Sql constructor calls * ensureTables() which in turn calls this object and the expectations on * it are the actual test and there are no additional asserts added. */ protected function runEnsureTablesTest($schema) { $database = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock(); $database->expects($this->any())->method('schema')->willReturn($schema); $migration = $this->getMigration(); $plugin = $this->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface'); $plugin->expects($this->any())->method('getIds')->willReturn(array('source_id_property' => array('type' => 'integer'))); $migration->expects($this->any())->method('getSourcePlugin')->willReturn($plugin); $plugin = $this->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface'); $plugin->expects($this->any())->method('getIds')->willReturn(array('destination_id_property' => array('type' => 'string'))); $migration->expects($this->any())->method('getDestinationPlugin')->willReturn($plugin); /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */ $event_dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $map = new TestSqlIdMap($database, array(), 'sql', array(), $migration, $event_dispatcher); $map->getDatabase(); }