Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,31 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\Entity\MigrationTest.
*/
namespace Drupal\Tests\migrate\Unit\Entity;
use Drupal\migrate\Entity\Migration;
use Drupal\Tests\UnitTestCase;
/**
* Tests the migrate entity.
*
* @coversDefaultClass \Drupal\migrate\Entity\Migration
* @group migrate
*/
class MigrationTest extends UnitTestCase {
/**
* Tests Migration::getProcessPlugins()
*
* @covers ::getProcessPlugins
*/
public function testGetProcessPlugins() {
$migration = new Migration([], 'migration');
$this->assertEquals([], $migration->getProcessPlugins([]));
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\Exception\RequirementsExceptionTest.
*/
namespace Drupal\Tests\migrate\Unit\Exception;
use Drupal\migrate\Exception\RequirementsException;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateExecutableMemoryExceededTest.
*/
namespace Drupal\Tests\migrate\Unit;
/**
@ -17,7 +12,7 @@ class MigrateExecutableMemoryExceededTest extends MigrateTestCase {
/**
* The mocked migration entity.
*
* @var \Drupal\migrate\Entity\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\migrate\Plugin\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $migration;

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateExecutableTest.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Component\Utility\Html;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Row;
@ -22,7 +17,7 @@ class MigrateExecutableTest extends MigrateTestCase {
/**
* The mocked migration entity.
*
* @var \Drupal\migrate\Entity\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\migrate\Plugin\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $migration;

View file

@ -49,7 +49,7 @@ class MigrateSourceTest extends MigrateTestCase {
/**
* The migration entity.
*
* @var \Drupal\migrate\Entity\Migration
* @var \Drupal\migrate\Plugin\MigrationInterface
*/
protected $migration;
@ -371,7 +371,7 @@ class MigrateSourceTest extends MigrateTestCase {
/**
* Gets a mock executable for the test.
*
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
*
* @return \Drupal\migrate\MigrateExecutable

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\migrate\Plugin\MigrateIdMapInterface;

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Row;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Database\Query\SelectInterface;

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\MigrateTestCase.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
/**
@ -34,18 +29,18 @@ abstract class MigrateTestCase extends UnitTestCase {
/**
* Local store for mocking setStatus()/getStatus().
*
* @var \Drupal\migrate\Entity\MigrationInterface::STATUS_*
* @var \Drupal\migrate\Plugin\MigrationInterface::STATUS_*
*/
protected $migrationStatus = MigrationInterface::STATUS_IDLE;
/**
* Retrieves a mocked migration.
*
* @return \Drupal\migrate\Entity\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
* @return \Drupal\migrate\Plugin\MigrationInterface|\PHPUnit_Framework_MockObject_MockObject
* The mocked migration.
*/
protected function getMigration() {
$this->migrationConfiguration += ['migrationClass' => 'Drupal\migrate\Entity\Migration'];
$this->migrationConfiguration += ['migrationClass' => 'Drupal\migrate\Plugin\Migration'];
$this->idMap = $this->getMock('Drupal\migrate\Plugin\MigrateIdMapInterface');
$this->idMap
@ -83,9 +78,9 @@ abstract class MigrateTestCase extends UnitTestCase {
$configuration = &$this->migrationConfiguration;
$migration->method('get')
->willReturnCallback(function ($argument) use (&$configuration) {
return isset($configuration[$argument]) ? $configuration[$argument] : '';
$migration->method('getHighWaterProperty')
->willReturnCallback(function () use ($configuration) {
return isset($configuration['highWaterProperty']) ? $configuration['highWaterProperty'] : '';
});
$migration->method('set')

View file

@ -7,16 +7,18 @@
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\Migration;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\Plugin\MigrateDestinationInterface;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\migrate\Plugin\RequirementsInterface;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\migrate\Entity\Migration
* @coversDefaultClass \Drupal\migrate\Plugin\Migration
*
* @group Migration
*/
class MigrationTest extends UnitTestCase {
@ -84,16 +86,16 @@ class MigrationTest extends UnitTestCase {
$migration->setSourcePlugin($source_plugin);
$migration->setDestinationPlugin($destination_plugin);
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$migration->setEntityManager($entity_manager);
$plugin_manager = $this->getMock('Drupal\migrate\Plugin\MigrationPluginManagerInterface');
$migration->setMigrationPluginManager($plugin_manager);
// We setup the requirements that test_a doesn't exist and test_c is not
// completed yet.
$migration->setRequirements(['test_a', 'test_b', 'test_c', 'test_d']);
$migration_b = $this->getMock('Drupal\migrate\Entity\MigrationInterface');
$migration_c = $this->getMock('Drupal\migrate\Entity\MigrationInterface');
$migration_d = $this->getMock('Drupal\migrate\Entity\MigrationInterface');
$migration_b = $this->getMock(MigrationInterface::class);
$migration_c = $this->getMock(MigrationInterface::class);
$migration_d = $this->getMock(MigrationInterface::class);
$migration_b->expects($this->once())
->method('allRowsProcessed')
@ -105,15 +107,10 @@ class MigrationTest extends UnitTestCase {
->method('allRowsProcessed')
->willReturn(TRUE);
$migration_storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
$migration_storage->expects($this->once())
->method('loadMultiple')
$plugin_manager->expects($this->once())
->method('createInstances')
->with(['test_a', 'test_b', 'test_c', 'test_d'])
->willReturn(['test_b' => $migration_b, 'test_c' => $migration_c, 'test_d' => $migration_d]);
$entity_manager->expects($this->once())
->method('getStorage')
->with('migration')
->willReturn($migration_storage);
$migration->checkRequirements();
}
@ -162,13 +159,13 @@ class TestMigration extends Migration {
}
/**
* Sets the entity manager service.
* Sets the plugin manager service.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager service.
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager
* The plugin manager service.
*/
public function setEntityManager(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function setMigrationPluginManager(MigrationPluginManagerInterface $plugin_manager) {
$this->migrationPluginManager = $plugin_manager;
}
}

View file

@ -11,7 +11,7 @@ use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Row;
@ -26,7 +26,7 @@ use Drupal\Tests\UnitTestCase;
class EntityContentBaseTest extends UnitTestCase {
/**
* @var \Drupal\migrate\Entity\MigrationInterface
* @var \Drupal\migrate\Plugin\MigrationInterface
*/
protected $migration;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\RowTest.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\migrate\Plugin\MigrateIdMapInterface;

View file

@ -7,6 +7,7 @@
namespace Drupal\Tests\migrate\Unit;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
use Drupal\Tests\UnitTestCase;
@ -61,7 +62,7 @@ class SqlBaseTest extends UnitTestCase {
->willReturn($idmap_connection);
// Setup a migration entity.
$migration = $this->getMock('Drupal\migrate\Entity\MigrationInterface');
$migration = $this->getMock(MigrationInterface::class);
$migration->expects($with_id_map ? $this->once() : $this->never())
->method('getIdMap')
->willReturn($id_map_is_sql ? $sql : NULL);

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\TestMigrateExecutable.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\StringTranslation\TranslationInterface;

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\TestSqlIdMap.
*/
namespace Drupal\Tests\migrate\Unit;
use Drupal\Core\Database\Connection;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\id_map\Sql;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@ -29,7 +24,7 @@ class TestSqlIdMap extends Sql implements \Iterator {
* The plugin ID for the migration process to do.
* @param mixed $plugin_definition
* The configuration for the plugin.
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration to do.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher service.

View file

@ -1,12 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\destination\ConfigTest.
*/
namespace Drupal\Tests\migrate\Unit\destination;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\Config;
use Drupal\Tests\UnitTestCase;
@ -23,7 +19,7 @@ class ConfigTest extends UnitTestCase {
$source = array(
'test' => 'x',
);
$migration = $this->getMockBuilder('Drupal\migrate\Entity\Migration')
$migration = $this->getMockBuilder('Drupal\migrate\Plugin\Migration')
->disableOriginalConstructor()
->getMock();
$config = $this->getMockBuilder('Drupal\Core\Config\Config')
@ -73,7 +69,7 @@ class ConfigTest extends UnitTestCase {
$source = array(
'langcode' => 'mi',
);
$migration = $this->getMockBuilder('Drupal\migrate\Entity\Migration')
$migration = $this->getMockBuilder(MigrationInterface::class)
->disableOriginalConstructor()
->getMock();
$config = $this->getMockBuilder('Drupal\Core\Config\Config')

View file

@ -9,6 +9,7 @@ namespace Drupal\Tests\migrate\Unit\destination;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\EntityRevision as RealEntityRevision;
use Drupal\migrate\Row;
use Drupal\Tests\UnitTestCase;
@ -22,7 +23,7 @@ use Drupal\Tests\UnitTestCase;
class EntityRevisionTest extends UnitTestCase {
/**
* @var \Drupal\migrate\Entity\MigrationInterface
* @var \Drupal\migrate\Plugin\MigrationInterface
*/
protected $migration;
@ -45,7 +46,7 @@ class EntityRevisionTest extends UnitTestCase {
parent::setUp();
// Setup mocks to be used when creating a revision destination.
$this->migration = $this->prophesize('\Drupal\migrate\Entity\MigrationInterface');
$this->migration = $this->prophesize(MigrationInterface::class);
$this->storage = $this->prophesize('\Drupal\Core\Entity\EntityStorageInterface');
$this->entityManager = $this->prophesize('\Drupal\Core\Entity\EntityManagerInterface');
$this->fieldTypeManager = $this->prophesize('\Drupal\Core\Field\FieldTypePluginManagerInterface');

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\DedupeEntityTest.
*/
namespace Drupal\Tests\migrate\Unit\process;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\ExplodeTest.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\Plugin\migrate\process\Explode;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\ExtractTest.
*/
namespace Drupal\Tests\migrate\Unit\process;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\FlattenTest.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\Plugin\migrate\process\Flatten;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\IteratorTest.
*/
namespace Drupal\Tests\migrate\Unit\process;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\MachineNameTest.
*/
namespace Drupal\Tests\migrate\Unit\process;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\Tests\migrate\Unit\MigrateTestCase;

View file

@ -1,20 +1,14 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\MigrationTest.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\process\Migration;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
use Drupal\migrate\Plugin\MigrateDestinationInterface;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Plugin\MigratePluginManager;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Prophecy\Argument;
/**
@ -27,26 +21,28 @@ class MigrationTest extends MigrateProcessTestCase {
* @covers ::transform
*/
public function testTransformWithStubSkipping() {
$migration_entity = $this->prophesize(MigrationInterface::class);
$migration_storage = $this->prophesize(EntityStorageInterface::class);
$migration_plugin = $this->prophesize(MigrationInterface::class);
$migration_plugin_manager = $this->prophesize(MigrationPluginManagerInterface::class);
$process_plugin_manager = $this->prophesize(MigratePluginManager::class);
$destination_id_map = $this->prophesize(MigrateIdMapInterface::class);
$destination_migration = $this->prophesize(MigrationInterface::class);
$destination_migration->getIdMap()->willReturn($destination_id_map->reveal());
$migration_storage->loadMultiple(['destination_migration'])
->willReturn(['destination_migration' => $destination_migration->reveal()]);
$destination_id_map->lookupDestinationId([1])->willReturn(NULL);
// Ensure the migration plugin manager returns our migration.
$migration_plugin_manager->createInstances(Argument::exact(['destination_migration']))
->willReturn(['destination_migration' => $destination_migration->reveal()]);
$configuration = [
'no_stub' => TRUE,
'migration' => 'destination_migration',
];
$migration_entity->id()->willReturn('actual_migration');
$migration_plugin->id()->willReturn('actual_migration');
$destination_migration->getDestinationPlugin(TRUE)->shouldNotBeCalled();
$migration = new Migration($configuration, '', [], $migration_entity->reveal(), $migration_storage->reveal(), $process_plugin_manager->reveal());
$migration = new Migration($configuration, '', [], $migration_plugin->reveal(), $migration_plugin_manager->reveal(), $process_plugin_manager->reveal());
$result = $migration->transform(1, $this->migrateExecutable, $this->row, '');
$this->assertNull($result);
}
@ -55,27 +51,28 @@ class MigrationTest extends MigrateProcessTestCase {
* @covers ::transform
*/
public function testTransformWithStubbing() {
$migration_entity = $this->prophesize(MigrationInterface::class);
$migration_storage = $this->prophesize(EntityStorageInterface::class);
$migration_plugin = $this->prophesize(MigrationInterface::class);
$migration_plugin_manager = $this->prophesize(MigrationPluginManagerInterface::class);
$process_plugin_manager = $this->prophesize(MigratePluginManager::class);
$destination_id_map = $this->prophesize(MigrateIdMapInterface::class);
$destination_migration = $this->prophesize(MigrationInterface::class);
$destination_migration = $this->prophesize('Drupal\migrate\Plugin\Migration');
$destination_migration->getIdMap()->willReturn($destination_id_map->reveal());
$migration_storage->loadMultiple(['destination_migration'])
$migration_plugin_manager->createInstances(['destination_migration'])
->willReturn(['destination_migration' => $destination_migration->reveal()]);
$destination_id_map->lookupDestinationId([1])->willReturn(NULL);
$destination_id_map->saveIdMapping(Argument::any(), Argument::any(), MigrateIdMapInterface::STATUS_NEEDS_UPDATE)->willReturn(NULL);
$configuration = [
'no_stub' => FALSE,
'migration' => 'destination_migration',
];
$migration_entity->id()->willReturn('actual_migration');
$migration_plugin->id()->willReturn('actual_migration');
$destination_migration->id()->willReturn('destination_migration');
$destination_migration->getDestinationPlugin(TRUE)->shouldBeCalled();
$destination_migration->get('process')->willReturn([]);
$destination_migration->get('source')->willReturn([]);
$destination_migration->getProcess()->willReturn([]);
$destination_migration->getSourceConfiguration()->willReturn([]);
$source_plugin = $this->prophesize(MigrateSourceInterface::class);
$source_plugin->getIds()->willReturn(['nid']);
@ -84,7 +81,7 @@ class MigrationTest extends MigrateProcessTestCase {
$destination_plugin->import(Argument::any())->willReturn([2]);
$destination_migration->getDestinationPlugin(TRUE)->willReturn($destination_plugin->reveal());
$migration = new Migration($configuration, '', [], $migration_entity->reveal(), $migration_storage->reveal(), $process_plugin_manager->reveal());
$migration = new Migration($configuration, '', [], $migration_plugin->reveal(), $migration_plugin_manager->reveal(), $process_plugin_manager->reveal());
$result = $migration->transform(1, $this->migrateExecutable, $this->row, '');
$this->assertEquals(2, $result);
}

View file

@ -1,11 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\SkipOnEmptyTest.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\Plugin\migrate\process\SkipOnEmpty;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\StaticMapTest.
*/
namespace Drupal\Tests\migrate\Unit\process;