class MigrationStorageTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/tests/src/Unit/MigrationStorageTest.php \Drupal\Tests\migrate\Unit\MigrationStorageTest
@coversDefaultClass \Drupal\migrate\MigrationStorage @group migrate
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\migrate\Unit\MigrationStorageTest
Expanded class hierarchy of MigrationStorageTest
File
- core/
modules/ migrate/ tests/ src/ Unit/ MigrationStorageTest.php, line 23 - Contains \Drupal\Tests\migrate\Unit\MigrationStorageTest.
Namespace
Drupal\Tests\migrate\UnitView source
class MigrationStorageTest extends UnitTestCase {
/**
* @var \Drupal\Tests\migrate\Unit\TestMigrationStorage
*/
protected $storage;
/**
* @var \Drupal\Core\Entity\Query\QueryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $query;
/**
* {@inheritdoc}
*/
public function setUp() {
$this->query = $this
->getMock(QueryInterface::class);
$this->query
->method('condition')
->willReturnSelf();
$query_factory = $this
->getMock(QueryFactoryInterface::class);
$query_factory
->method('get')
->willReturn($this->query);
$this->storage = new TestMigrationStorage($this
->getMock(EntityTypeInterface::class), $this
->getMock(ConfigFactoryInterface::class), $this
->getMock(UuidInterface::class), $this
->getMock(LanguageManagerInterface::class), $query_factory);
}
/**
* Tests getVariantIds() when variants exist.
*
* @covers ::getVariantIds
*/
public function testGetVariantIdsWithVariants() {
$this->query
->method('execute')
->willReturn([
'd6_node__page',
'd6_node__article',
]);
$ids = $this->storage
->getVariantIds([
'd6_node:*',
'd6_user',
]);
$this
->assertSame([
'd6_node__page',
'd6_node__article',
'd6_user',
], $ids);
}
/**
* Tests getVariantIds() when no variants exist.
*
* @covers ::getVariantIds
*/
public function testGetVariantIdsNoVariants() {
$this->query
->method('execute')
->willReturn([]);
$ids = $this->storage
->getVariantIds([
'd6_node:*',
'd6_user',
]);
$this
->assertSame([
'd6_user',
], $ids);
}
/**
* Tests getVariantIds() when no variants exist and there are no static
* (non-variant) dependencies.
*
* @covers ::getVariantIds
*/
public function testGetVariantIdsNoVariantsOrStaticDependencies() {
$this->query
->method('execute')
->willReturn([]);
$ids = $this->storage
->getVariantIds([
'd6_node:*',
'd6_node_revision:*',
]);
$this
->assertSame([], $ids);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrationStorageTest:: |
protected | property | ||
MigrationStorageTest:: |
protected | property | ||
MigrationStorageTest:: |
public | function |
Overrides UnitTestCase:: |
|
MigrationStorageTest:: |
public | function | Tests getVariantIds() when no variants exist. | |
MigrationStorageTest:: |
public | function | Tests getVariantIds() when no variants exist and there are no static (non-variant) dependencies. | |
MigrationStorageTest:: |
public | function | Tests getVariantIds() when variants exist. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |