class TestSqlBase in Drupal 10
Same name in this branch
- 10 core/modules/migrate/tests/src/Unit/SqlBaseTest.php \Drupal\Tests\migrate\Unit\TestSqlBase
- 10 core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\TestSqlBase
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Unit/SqlBaseTest.php \Drupal\Tests\migrate\Unit\TestSqlBase
- 9 core/modules/migrate/tests/src/Unit/SqlBaseTest.php \Drupal\Tests\migrate\Unit\TestSqlBase
Creates a base source class for SQL migration testing.
Hierarchy
- class \Drupal\Tests\migrate\Unit\TestSqlBase extends \Drupal\migrate\Plugin\migrate\source\SqlBase
Expanded class hierarchy of TestSqlBase
File
- core/
modules/ migrate/ tests/ src/ Unit/ SqlBaseTest.php, line 148 - Contains \Drupal\Tests\migrate\Unit\SqlBaseTest.
Namespace
Drupal\Tests\migrate\UnitView source
class TestSqlBase extends SqlBase {
/**
* The database object.
*
* @var object
*/
protected $database;
/**
* The migration IDs.
*
* @var array
*/
protected $ids;
/**
* Override the constructor so we can create one easily.
*/
public function __construct() {
}
/**
* Allows us to set the database during tests.
*
* @param mixed $database
* The database mock object.
*/
public function setDatabase($database) {
$this->database = $database;
}
/**
* {@inheritdoc}
*/
public function getDatabase() {
return $this->database;
}
/**
* Allows us to set the migration during the test.
*
* @param mixed $migration
* The migration mock.
*/
public function setMigration($migration) {
$this->migration = $migration;
}
/**
* {@inheritdoc}
*/
public function mapJoinable() {
return parent::mapJoinable();
}
/**
* {@inheritdoc}
*/
public function getIds() {
return $this->ids;
}
/**
* Allows us to set the IDs during a test.
*
* @param array $ids
* An array of identifiers.
*/
public function setIds($ids) {
$this->ids = $ids;
}
/**
* {@inheritdoc}
*/
public function fields() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function query() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
return [];
}
}