diff --git a/core/lib/Drupal/Core/ContentNegotiation.php b/core/lib/Drupal/Core/ContentNegotiation.php deleted file mode 100644 index 10237ab8f..000000000 --- a/core/lib/Drupal/Core/ContentNegotiation.php +++ /dev/null @@ -1,43 +0,0 @@ -. - if ($request->get('ajax_iframe_upload', FALSE)) { - return 'iframeupload'; - } - - if ($request->query->has('_format')) { - return $request->query->get('_format'); - } - - // Do HTML last so that it always wins. - return 'html'; - } -} diff --git a/core/lib/Drupal/Core/Database/Install/TaskException.php b/core/lib/Drupal/Core/Database/Install/TaskException.php deleted file mode 100644 index cbf5c1a33..000000000 --- a/core/lib/Drupal/Core/Database/Install/TaskException.php +++ /dev/null @@ -1,13 +0,0 @@ -D7 upgrade path. - */ -class MigratePassword implements PasswordInterface { - - /** - * The original password service. - * - * @var \Drupal\Core\Password\PasswordInterface - */ - protected $originalPassword; - - /** - * Indicates if MD5 password prefixing is enabled. - */ - protected $enabled = FALSE; - - /** - * Builds the replacement password service class. - * - * @param \Drupal\Core\Password\PasswordInterface $original_password - * The password object. - */ - public function __construct(PasswordInterface $original_password) { - $this->originalPassword = $original_password; - } - - /** - * {@inheritdoc} - */ - public function check($password, $hash) { - return $this->originalPassword->check($password, $hash); - } - - /** - * {@inheritdoc} - */ - public function needsRehash($hash) { - return $this->originalPassword->needsRehash($hash); - } - - /** - * {@inheritdoc} - */ - public function hash($password) { - $hash = $this->originalPassword->hash($password); - - // Allow prefixing only if the service was asked to prefix. Check also if - // the $password pattern is conforming to a MD5 result. - if ($this->enabled && preg_match('/^[0-9a-f]{32}$/', $password)) { - $hash = 'U' . $hash; - } - - return $hash; - } - - /** - * Enables the MD5 password prefixing. - */ - public function enableMd5Prefixing() { - $this->enabled = TRUE; - } - - /** - * Disables the MD5 password prefixing. - */ - public function disableMd5Prefixing() { - $this->enabled = FALSE; - } - -} diff --git a/core/modules/migrate/src/MigrateServiceProvider.php b/core/modules/migrate/src/MigrateServiceProvider.php deleted file mode 100644 index 78a60bb8d..000000000 --- a/core/modules/migrate/src/MigrateServiceProvider.php +++ /dev/null @@ -1,30 +0,0 @@ -setDefinition('password_original', $container->getDefinition('password')); - $container->setDefinition('password', $container->getDefinition('password_migrate')); - } - -} diff --git a/core/modules/migrate/src/Plugin/SourceEntityInterface.php b/core/modules/migrate/src/Plugin/SourceEntityInterface.php deleted file mode 100644 index 8379f6a83..000000000 --- a/core/modules/migrate/src/Plugin/SourceEntityInterface.php +++ /dev/null @@ -1,32 +0,0 @@ -state = $state; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - $entity_type = static::getEntityTypeId($plugin_id); - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('entity.manager')->getStorage($entity_type), - array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), - $container->get('entity.manager'), - $container->get('state') - ); - } - - /** - * {@inheritdoc} - */ - public function import(Row $row, array $old_destination_id_values = array()) { - if ($row->isStub() && ($state = $this->state->get('comment.maintain_entity_statistics', 0))) { - $this->state->set('comment.maintain_entity_statistics', 0); - } - $return = parent::import($row, $old_destination_id_values); - if ($row->isStub() && $state) { - $this->state->set('comment.maintain_entity_statistics', $state); - } - return $return; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityCommentType.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityCommentType.php deleted file mode 100644 index 79be04b48..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityCommentType.php +++ /dev/null @@ -1,28 +0,0 @@ -addBodyField(reset($entity_ids)); - return $entity_ids; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityDateFormat.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityDateFormat.php deleted file mode 100644 index d471ceac0..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityDateFormat.php +++ /dev/null @@ -1,34 +0,0 @@ -setPattern($value); - } - else { - parent::updateEntityProperty($entity, $parents, $value); - } - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityFile.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityFile.php deleted file mode 100644 index 57d690925..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityFile.php +++ /dev/null @@ -1,244 +0,0 @@ - '', - 'source_path_property' => 'filepath', - 'destination_path_property' => 'uri', - 'move' => FALSE, - 'urlencode' => FALSE, - ); - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager); - - $this->streamWrapperManager = $stream_wrappers; - $this->fileSystem = $file_system; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - $entity_type = static::getEntityTypeId($plugin_id); - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('entity.manager')->getStorage($entity_type), - array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), - $container->get('entity.manager'), - $container->get('stream_wrapper_manager'), - $container->get('file_system') - ); - } - - /** - * {@inheritdoc} - */ - public function import(Row $row, array $old_destination_id_values = array()) { - $file = $row->getSourceProperty($this->configuration['source_path_property']); - $destination = $row->getDestinationProperty($this->configuration['destination_path_property']); - $source = $this->configuration['source_base_path'] . $file; - - // Ensure the source file exists, if it's a local URI or path. - if ($this->isLocalUri($source) && !file_exists($source)) { - throw new MigrateException("File '$source' does not exist."); - } - - // If the start and end file is exactly the same, there is nothing to do. - if ($this->isLocationUnchanged($source, $destination)) { - return parent::import($row, $old_destination_id_values); - } - - $replace = $this->getOverwriteMode($row); - $success = $this->writeFile($source, $destination, $replace); - if (!$success) { - $dir = $this->getDirectory($destination); - if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) { - $success = $this->writeFile($source, $destination, $replace); - } - else { - throw new MigrateException("Could not create directory '$dir'"); - } - } - - if ($success) { - return parent::import($row, $old_destination_id_values); - } - else { - throw new MigrateException("File $source could not be copied to $destination."); - } - } - - /** - * Tries to move or copy a file. - * - * @param string $source - * The source path or URI. - * @param string $destination - * The destination path or URI. - * @param integer $replace - * FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME. - * - * @return bool - * TRUE on success, FALSE on failure. - */ - protected function writeFile($source, $destination, $replace = FILE_EXISTS_REPLACE) { - if ($this->configuration['move']) { - return (boolean) file_unmanaged_move($source, $destination, $replace); - } - else { - $destination = file_destination($destination, $replace); - $source = $this->urlencode($source); - return @copy($source, $destination); - } - } - - /** - * Determines how to handle file conflicts. - * - * @param \Drupal\migrate\Row $row - * - * @return integer - * Either FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME, depending - * on the current configuration. - */ - protected function getOverwriteMode(Row $row) { - if (!empty($this->configuration['rename'])) { - $entity_id = $row->getDestinationProperty($this->getKey('id')); - if ($entity_id && ($entity = $this->storage->load($entity_id))) { - return FILE_EXISTS_RENAME; - } - } - return FILE_EXISTS_REPLACE; - } - - /** - * Returns the directory component of a URI or path. - * - * For URIs like public://foo.txt, the full physical path of public:// - * will be returned, since a scheme by itself will trip up certain file - * API functions (such as file_prepare_directory()). - * - * @param string $uri - * The URI or path. - * - * @return string|false - * The directory component of the path or URI, or FALSE if it could not - * be determined. - */ - protected function getDirectory($uri) { - $dir = $this->fileSystem->dirname($uri); - if (substr($dir, -3) == '://') { - return $this->fileSystem->realpath($dir); - } - else { - return $dir; - } - } - - /** - * Returns if the source and destination URIs represent identical paths. - * If either URI is a remote stream, will return FALSE. - * - * @param string $source - * The source URI. - * @param string $destination - * The destination URI. - * - * @return bool - * TRUE if the source and destination URIs refer to the same physical path, - * otherwise FALSE. - */ - protected function isLocationUnchanged($source, $destination) { - if ($this->isLocalUri($source) && $this->isLocalUri($destination)) { - return $this->fileSystem->realpath($source) === $this->fileSystem->realpath($destination); - } - else { - return FALSE; - } - } - - /** - * Returns if the given URI or path is considered local. - * - * A URI or path is considered local if it either has no scheme component, - * or the scheme is implemented by a stream wrapper which extends - * \Drupal\Core\StreamWrapper\LocalStream. - * - * @param string $uri - * The URI or path to test. - * - * @return bool - */ - protected function isLocalUri($uri) { - $scheme = $this->fileSystem->uriScheme($uri); - return $scheme === FALSE || $this->streamWrapperManager->getViaScheme($scheme) instanceof LocalStream; - } - - /** - * Urlencode all the components of a remote filename. - * - * @param string $filename - * The filename of the file to be urlencoded. - * - * @return string - * The urlencoded filename. - */ - protected function urlencode($filename) { - // Only apply to a full URL - if ($this->configuration['urlencode'] && strpos($filename, '://')) { - $components = explode('/', $filename); - foreach ($components as $key => $component) { - $components[$key] = rawurlencode($component); - } - $filename = implode('/', $components); - // Actually, we don't want certain characters encoded - $filename = str_replace('%3A', ':', $filename); - $filename = str_replace('%3F', '?', $filename); - $filename = str_replace('%26', '&', $filename); - } - return $filename; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityNodeType.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityNodeType.php deleted file mode 100644 index a6bee84e2..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityNodeType.php +++ /dev/null @@ -1,31 +0,0 @@ -getDestinationProperty('create_body')) { - $node_type = $this->storage->load(reset($entity_ids)); - node_add_body_field($node_type, $row->getDestinationProperty('create_body_label')); - } - return $entity_ids; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityUser.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityUser.php deleted file mode 100644 index 786988fee..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityUser.php +++ /dev/null @@ -1,101 +0,0 @@ -password = $password; - } - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - $entity_type = static::getEntityTypeId($plugin_id); - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('entity.manager')->getStorage($entity_type), - array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), - $container->get('entity.manager'), - $container->get('password') - ); - } - - /** - * {@inheritdoc} - * @throws \Drupal\migrate\MigrateException - */ - public function import(Row $row, array $old_destination_id_values = array()) { - if ($this->password) { - if ($this->password instanceof MigratePassword) { - $this->password->enableMd5Prefixing(); - } - else { - throw new MigrateException('Password service has been altered by another module, aborting.'); - } - } - $ids = parent::import($row, $old_destination_id_values); - if ($this->password) { - $this->password->disableMd5Prefixing(); - } - - return $ids; - } - -} diff --git a/core/modules/migrate/src/Plugin/migrate/destination/UserData.php b/core/modules/migrate/src/Plugin/migrate/destination/UserData.php deleted file mode 100644 index eb16ccdec..000000000 --- a/core/modules/migrate/src/Plugin/migrate/destination/UserData.php +++ /dev/null @@ -1,94 +0,0 @@ -userData = $user_data; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('user.data') - ); - } - - /** - * {@inheritdoc} - */ - public function import(Row $row, array $old_destination_id_values = array()) { - $uid = $row->getDestinationProperty('uid'); - $module = $row->getDestinationProperty('module'); - $key = $row->getDestinationProperty('key'); - $this->userData->set($module, $uid, $key, $row->getDestinationProperty('settings')); - - return [$uid, $module, $key]; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['uid']['type'] = 'integer'; - $ids['module']['type'] = 'string'; - $ids['key']['type'] = 'string'; - return $ids; - } - - /** - * {@inheritdoc} - */ - public function fields(MigrationInterface $migration = NULL) { - return [ - 'uid' => 'The user id.', - 'module' => 'The module name responsible for the settings.', - 'key' => 'The setting key to save under.', - 'settings' => 'The settings to save.', - ]; - } - -} diff --git a/core/modules/migrate/src/Tests/EntityFileTest.php b/core/modules/migrate/src/Tests/EntityFileTest.php deleted file mode 100644 index 718e0a750..000000000 --- a/core/modules/migrate/src/Tests/EntityFileTest.php +++ /dev/null @@ -1,295 +0,0 @@ -destination = new TestEntityFile([]); - $this->destination->streamWrapperManager = \Drupal::getContainer()->get('stream_wrapper_manager'); - $this->destination->fileSystem = \Drupal::getContainer()->get('file_system'); - $this->installEntitySchema('file'); - - file_put_contents('/tmp/test-file.jpg', ''); - } - - /** - * Test successful imports/copies. - */ - public function testSuccessfulCopies() { - foreach ($this->localFileDataProvider() as $data) { - list($row_values, $destination_path, $expected, $source_base_path) = $data; - - $this->doImport($row_values, $destination_path, $source_base_path); - $message = $expected ? sprintf('File %s exists', $destination_path) : sprintf('File %s does not exist', $destination_path); - $this->assertIdentical($expected, is_file($destination_path), $message); - } - } - - /** - * The data provider for testing the file destination. - * - * @return array - * An array of file permutations to test. - */ - protected function localFileDataProvider() { - global $base_url; - return [ - // Test a local to local copy. - [['filepath' => 'core/modules/simpletest/files/image-test.jpg'], 'public://file1.jpg', TRUE, DRUPAL_ROOT . '/'], - // Test a temporary file using an absolute path. - [['filepath' => '/tmp/test-file.jpg'], 'temporary://test.jpg', TRUE, ''], - // Test a temporary file using a relative path. - [['filepath' => 'test-file.jpg'], 'temporary://core/modules/simpletest/files/test.jpg', TRUE, '/tmp/'], - // Test a remote path to local. - [['filepath' => 'core/modules/simpletest/files/image-test.jpg'], 'public://remote-file.jpg', TRUE, $base_url . '/'], - // Test a remote path to local inside a folder that doesn't exist. - [['filepath' => 'core/modules/simpletest/files/image-test.jpg'], 'public://folder/remote-file.jpg', TRUE, DRUPAL_ROOT . '/'], - ]; - } - - /** - * Test that non-existent files throw an exception. - */ - public function testNonExistentSourceFile() { - $destination = '/non/existent/file'; - try { - // If this test passes, doImport() will raise a MigrateException and - // we'll never reach fail(). - $this->doImport(['filepath' => $destination], 'public://wontmatter.jpg'); - $this->fail('Expected Drupal\migrate\MigrateException when importing ' . $destination); - } - catch (MigrateException $e) { - $this->assertIdentical($e->getMessage(), "File '$destination' does not exist."); - } - } - - /** - * Tests various invocations of the writeFile() method. - */ - public function testWriteFile() { - $plugin = $this->destination; - $method = new \ReflectionMethod($plugin, 'writeFile'); - $method->setAccessible(TRUE); - - touch('temporary://baz.txt'); - - // Moving an actual file should return TRUE. - $plugin->configuration['move'] = TRUE; - $this->assertTrue($method->invoke($plugin, 'temporary://baz.txt', 'public://foo.txt')); - - // Trying to move a non-existent file should return FALSE. - $this->assertFalse($method->invoke($plugin, 'temporary://invalid.txt', 'public://invalid.txt')); - - // Copying over a file that already exists should replace the existing file. - $plugin->configuration['move'] = FALSE; - touch('temporary://baz.txt'); - $this->assertTrue($method->invoke($plugin, 'temporary://baz.txt', 'public://foo.txt')); - // Copying over a file that already exists should rename the resulting file - // if FILE_EXISTS_RENAME is specified. - $method->invoke($plugin, 'temporary://baz.txt', 'public://foo.txt', FILE_EXISTS_RENAME); - $this->assertTrue(file_exists('public://foo_0.txt')); - - // Trying to copy a non-existent file should return FALSE. - $this->assertFalse($method->invoke($plugin, 'temporary://invalid.txt', 'public://invalid.txt')); - } - - /** - * Tests various invocations of the getOverwriteMode() method. - */ - public function testGetOverwriteMode() { - $plugin = $this->destination; - $method = new \ReflectionMethod($plugin, 'getOverwriteMode'); - $method->setAccessible(TRUE); - - $row = new Row([], []); - // If the plugin is not configured to rename the destination file, we should - // always get FILE_EXISTS_REPLACE. - $this->assertIdentical(FILE_EXISTS_REPLACE, $method->invoke($plugin, $row)); - - // When the plugin IS configured to rename the destination file, it should - // return FILE_EXISTS_RENAME if the destination entity already exists, - // and FILE_EXISTS_REPLACE otherwise. - $plugin->configuration['rename'] = TRUE; - $plugin->storage = \Drupal::entityManager()->getStorage('file'); - /** @var \Drupal\file\FileInterface $file */ - $file = $plugin->storage->create(); - touch('public://foo.txt'); - $file->setFileUri('public://foo.txt'); - $file->save(); - $row->setDestinationProperty($plugin->storage->getEntityType()->getKey('id'), $file->id()); - $this->assertIdentical(FILE_EXISTS_RENAME, $method->invoke($plugin, $row)); - unlink('public://foo.txt'); - } - - /** - * Tests various invocations of the getDirectory() method. - */ - public function testGetDirectory() { - $plugin = $this->destination; - $method = new \ReflectionMethod($plugin, 'getDirectory'); - $method->setAccessible(TRUE); - - $this->assertEqual('public://foo', $method->invoke($plugin, 'public://foo/baz.txt')); - $this->assertEqual('/path/to', $method->invoke($plugin, '/path/to/foo.txt')); - // A directory like public:// (no path) needs to resolve to a physical path. - $fs = \Drupal::getContainer()->get('file_system'); - $this->assertEqual($fs->realpath(Settings::get('file_public_path')), $method->invoke($plugin, 'public://foo.txt')); - } - - /** - * Tests various invocations of the isLocationUnchanged() method. - */ - public function testIsLocationUnchanged() { - $plugin = $this->destination; - $method = new \ReflectionMethod($plugin, 'isLocationUnchanged'); - $method->setAccessible(TRUE); - - $public_dir = Settings::get('file_public_path'); - - // Due to the limitations of realpath(), the source file must exist. - touch('public://foo.txt'); - $this->assertTrue($method->invoke($plugin, $public_dir . '/foo.txt', 'public://foo.txt')); - unlink('public://foo.txt'); - - $temporary_file = '/tmp/foo.txt'; - touch($temporary_file); - $this->assertTrue($method->invoke($plugin, $temporary_file, 'temporary://foo.txt')); - unlink($temporary_file); - } - - /** - * Tests various invocations of the isLocalUri() method. - */ - public function testIsLocalUri() { - $plugin = $this->destination; - $method = new \ReflectionMethod($plugin, 'isLocalUri'); - $method->setAccessible(TRUE); - - $this->assertTrue($method->invoke($plugin, 'public://foo.txt')); - $this->assertTrue($method->invoke($plugin, 'public://path/to/foo.txt')); - $this->assertTrue($method->invoke($plugin, 'temporary://foo.txt')); - $this->assertTrue($method->invoke($plugin, 'temporary://path/to/foo.txt')); - $this->assertTrue($method->invoke($plugin, 'foo.txt')); - $this->assertTrue($method->invoke($plugin, '/path/to/files/foo.txt')); - $this->assertTrue($method->invoke($plugin, 'relative/path/to/foo.txt')); - $this->assertFalse($method->invoke($plugin, 'http://www.example.com/foo.txt')); - } - - /** - * Do an import using the destination. - * - * @param array $row_values - * An array of row values. - * @param string $destination_path - * The destination path to copy to. - * @param string $source_base_path - * The source base path. - * @return array - * An array of saved entities ids. - * - * @throws \Drupal\migrate\MigrateException - */ - protected function doImport($row_values, $destination_path, $source_base_path = '') { - $row = new Row($row_values, []); - $row->setDestinationProperty('uri', $destination_path); - $this->destination->configuration['source_base_path'] = $source_base_path; - - // Importing asserts there are no errors, then we just check the file has - // been copied into place. - return $this->destination->import($row, array()); - } - -} - -class TestEntityFile extends EntityFile { - - /** - * This is needed to be passed to $this->save(). - * - * @var \Drupal\Core\Entity\ContentEntityInterface - */ - public $mockEntity; - - /** - * Make this public for easy writing during tests. - * - * @var array - */ - public $configuration; - - /** - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - public $storage; - - /** - * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface - */ - public $streamWrapperManager; - - /** - * @var \Drupal\Core\File\FileSystemInterface - */ - public $fileSystem; - - public function __construct($configuration) { - $configuration += array( - 'source_base_path' => '', - 'source_path_property' => 'filepath', - 'destination_path_property' => 'uri', - 'move' => FALSE, - 'urlencode' => FALSE, - ); - $this->configuration = $configuration; - // We need a mock entity to be passed to save to prevent strict exceptions. - $this->mockEntity = EntityTest::create(); - } - - /** - * {@inheritdoc} - */ - protected function getEntity(Row $row, array $old_destination_id_values) { - return $this->mockEntity; - } - - /** - * {@inheritdoc} - */ - protected function save(ContentEntityInterface $entity, array $old_destination_id_values = array()) {} - -} diff --git a/core/modules/migrate/tests/src/Unit/process/MigrationTest.php b/core/modules/migrate/tests/src/Unit/process/MigrationTest.php deleted file mode 100644 index 0a15c9e39..000000000 --- a/core/modules/migrate/tests/src/Unit/process/MigrationTest.php +++ /dev/null @@ -1,85 +0,0 @@ -migrationConfiguration = [ - 'id' => 'test', - 'process' => [], - 'source' => [], - ]; - - parent::setUp(); - } - - /** - * Assert that exceptions during import are logged. - * @expectedException \Drupal\migrate\MigrateSkipRowException - * @covers ::transform - */ - public function testSaveOnException() { - - // A bunch of mock objects to get thing working - $migration = $this->getMigration(); - $migration_source = $this->getMock('\Drupal\migrate\Plugin\MigrateSourceInterface'); - $migration_source->expects($this->once()) - ->method('getIds') - ->willReturn([]); - $migration->expects($this->once()) - ->method('getSourcePlugin') - ->willReturn($migration_source); - $migration_destination = $this->getMock('\Drupal\migrate\Plugin\MigrateDestinationInterface'); - $migration->expects($this->once()) - ->method('getDestinationPlugin') - ->willReturn($migration_destination); - $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); - $storage->expects($this->once()) - ->method('loadMultiple') - ->willReturn([ - 'id' => $migration - ]); - $manager = $this->getMockBuilder('\Drupal\migrate\Plugin\MigratePluginManager') - ->disableOriginalConstructor() - ->getMock(); - - // Throw an exception during import so we can log it. - $migration_destination->expects($this->once()) - ->method('import') - ->willThrowException(new MigrateException()); - - // Build our migration plugin. - $plugin = new Migration(['migration' => []], - 'migration', // ? - [], - $migration, - $storage, - $manager); - - // Assert that we log exceptions thrown during the import. - $this->migrateExecutable->expects($this->once()) - ->method('saveMessage'); - - $plugin->transform('value', $this->migrateExecutable, $this->row, 'prop'); - } - -} diff --git a/core/modules/migrate_drupal/src/MigrationStorage.php b/core/modules/migrate_drupal/src/MigrationStorage.php deleted file mode 100644 index 9a33b3607..000000000 --- a/core/modules/migrate_drupal/src/MigrationStorage.php +++ /dev/null @@ -1,236 +0,0 @@ -cckPluginManager = $cck_plugin_manager; - } - - /** - * {@inheritdoc} - */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static( - $entity_type, - $container->get('config.factory'), - $container->get('uuid'), - $container->get('language_manager'), - $container->get('plugin.manager.migrate.cckfield') - ); - } - - /** - * {@inheritdoc} - */ - public function loadMultiple(array $ids = NULL) { - $ids_to_load = array(); - $dynamic_ids = array(); - if (isset($ids)) { - foreach ($ids as $id) { - // Evaluate whether or not this migration is dynamic in the form of - // migration_id:* to load all the additional migrations. - if (($n = strpos($id, ':')) !== FALSE) { - $base_id = substr($id, 0, $n); - $ids_to_load[] = $base_id; - // Get the ids of the additional migrations. - $sub_id = substr($id, $n + 1); - if ($sub_id == '*') { - // If the id of the additional migration is '*', get all of them. - $dynamic_ids[$base_id] = NULL; - } - elseif (!isset($dynamic_ids[$base_id]) || is_array($dynamic_ids[$base_id])) { - $dynamic_ids[$base_id][] = $sub_id; - } - } - else { - $ids_to_load[] = $id; - } - } - $ids = array_flip($ids); - } - else { - $ids_to_load = NULL; - } - - /** @var \Drupal\migrate_drupal\Entity\MigrationInterface[] $entities */ - $entities = parent::loadMultiple($ids_to_load); - if (!isset($ids)) { - // Changing the array being foreach()'d is not a good idea. - $return = array(); - foreach ($entities as $entity_id => $entity) { - if ($plugin = $entity->getLoadPlugin()) { - $new_entities = $plugin->loadMultiple($this); - $this->postLoad($new_entities); - $this->getDynamicIds($dynamic_ids, $new_entities); - $return += $new_entities; - } - else { - $return[$entity_id] = $entity; - } - } - $entities = $return; - } - else { - foreach ($dynamic_ids as $base_id => $sub_ids) { - $entity = $entities[$base_id]; - if ($plugin = $entity->getLoadPlugin()) { - unset($entities[$base_id]); - $new_entities = $plugin->loadMultiple($this, $sub_ids); - $this->postLoad($new_entities); - if (!isset($sub_ids)) { - unset($dynamic_ids[$base_id]); - $this->getDynamicIds($dynamic_ids, $new_entities); - } - $entities += $new_entities; - } - } - } - - // Allow modules providing cck field plugins to alter the required - // migrations to assist with the migration a custom field type. - $this->applyCckFieldProcessors($entities); - - // Build an array of dependencies and set the order of the migrations. - return $this->buildDependencyMigration($entities, $dynamic_ids); - } - - /** - * Extract the dynamic id mapping from entities loaded by plugin. - * - * @param array $dynamic_ids - * Get the dynamic migration ids. - * @param array $entities - * An array of entities. - */ - protected function getDynamicIds(array &$dynamic_ids, array $entities) { - foreach (array_keys($entities) as $new_id) { - list($base_id, $sub_id) = explode(':', $new_id, 2); - $dynamic_ids[$base_id][] = $sub_id; - } - } - - /** - * {@inheritdoc} - */ - public function save(EntityInterface $entity) { - if (strpos($entity->id(), ':') !== FALSE) { - throw new EntityStorageException("Dynamic migration '{$entity->id()}' can't be saved"); - } - return parent::save($entity); - } - - /** - * Allow any field type plugins to adjust the migrations as required. - * - * @param \Drupal\migrate\Entity\Migration[] $entities - * An array of migration entities. - */ - protected function applyCckFieldProcessors(array $entities) { - $method_map = $this->getMigrationPluginMethodMap(); - - foreach ($entities as $entity_id => $migration) { - // Allow field plugins to process the required migrations. - if (isset($method_map[$entity_id])) { - $method = $method_map[$entity_id]; - $cck_plugins = $this->getCckFieldPlugins(); - - array_walk($cck_plugins, function ($plugin) use ($method, $migration) { - $plugin->$method($migration); - }); - } - - // If this is a CCK bundle migration, allow the cck field plugins to add - // any field type processing. - $source_plugin = $migration->getSourcePlugin(); - if ($source_plugin instanceof CckFieldMigrateSourceInterface && strpos($entity_id, SourcePluginBase::DERIVATIVE_SEPARATOR)) { - $plugins = $this->getCckFieldPlugins(); - foreach ($source_plugin->fieldData() as $field_name => $data) { - if (isset($plugins[$data['type']])) { - $plugins[$data['type']]->processCckFieldValues($migration, $field_name, $data); - } - } - } - } - } - - /** - * Get an array of loaded cck field plugins. - * - * @return \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface[] - * An array of cck field process plugins. - */ - protected function getCckFieldPlugins() { - if (!isset($this->cckFieldPlugins)) { - $this->cckFieldPlugins = []; - foreach ($this->cckPluginManager->getDefinitions() as $definition) { - $this->cckFieldPlugins[$definition['id']] = $this->cckPluginManager->createInstance($definition['id']); - } - } - return $this->cckFieldPlugins; - } - - /** - * Provides a map between migration ids and the cck field plugin method. - * - * @return array - * The map between migrations and cck field plugin processing methods. - */ - protected function getMigrationPluginMethodMap() { - return [ - 'd6_field' => 'processField', - 'd6_field_instance' => 'processFieldInstance', - 'd6_field_instance_widget_settings' => 'processFieldWidget', - 'd6_field_formatter_settings' => 'processFieldFormatter', - ]; - } - -} diff --git a/core/modules/migrate_drupal/src/Plugin/CckFieldMigrateSourceInterface.php b/core/modules/migrate_drupal/src/Plugin/CckFieldMigrateSourceInterface.php deleted file mode 100644 index 469d29f0f..000000000 --- a/core/modules/migrate_drupal/src/Plugin/CckFieldMigrateSourceInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - 'file_generic', - ]; - } - - /** - * {@inheritdoc} - */ - public function getFieldFormatterMap() { - return [ - 'default' => 'file_default', - 'url_plain' => 'file_url_plain', - 'path_plain' => 'file_url_plain', - 'image_plain' => 'image', - 'image_nodelink' => 'image', - 'image_imagelink' => 'image', - ]; - } - - /** - * {@inheritdoc} - */ - public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) { - $process = [ - 'plugin' => 'd6_cck_file', - 'source' => [ - $field_name, - $field_name . '_list', - $field_name . '_data', - ], - ]; - $migration->mergeProcessOfProperty($field_name, $process); - } - -} diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/LinkField.php b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/LinkField.php deleted file mode 100644 index 62dc8fde5..000000000 --- a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/LinkField.php +++ /dev/null @@ -1,50 +0,0 @@ - 'link', - 'plain' => 'link', - 'absolute' => 'link', - 'title_plain' => 'link', - 'url' => 'link', - 'short' => 'link', - 'label' => 'link', - 'separate' => 'link_separate', - ]; - } - - /** - * {@inheritdoc} - */ - public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) { - $process = [ - 'plugin' => 'd6_cck_link', - 'source' => [ - $field_name, - $field_name . '_title', - $field_name . '_attributes', - ], - ]; - $migration->mergeProcessOfProperty($field_name, $process); - } - -} diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/TextField.php b/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/TextField.php deleted file mode 100644 index 268ea606c..000000000 --- a/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/TextField.php +++ /dev/null @@ -1,71 +0,0 @@ - 'text_textfield', - ]; - } - - /** - * {@inheritdoc} - */ - public function getFieldFormatterMap() { - return [ - 'default' => 'text_default', - 'trimmed' => 'text_trimmed', - 'plain' => 'basic_string', - ]; - } - - /** - * {@inheritdoc} - */ - public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) { - // The data is stored differently depending on whether we're using - // db storage. - $value_key = $data['db_storage'] ? $field_name : "$field_name/value"; - $format_key = $data['db_storage'] ? $field_name . '_format' : "$field_name/format" ; - - $migration->setProcessOfProperty("$field_name/value", $value_key); - - // See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(), - // signature_format for an example of the YAML that represents this - // process array. - $process = [ - [ - 'plugin' => 'static_map', - 'bypass' => TRUE, - 'source' => $format_key, - 'map' => [0 => NULL] - ], - [ - 'plugin' => 'skip_on_empty', - 'method' => 'process', - ], - [ - 'plugin' => 'migration', - 'migration' => 'd6_filter_format', - 'source' => $format_key, - ], - ]; - $migration->mergeProcessOfProperty("$field_name/format", $process); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldRevisionTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldRevisionTest.php deleted file mode 100644 index 9ac6d26e4..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldRevisionTest.php +++ /dev/null @@ -1,84 +0,0 @@ - 'node', - 'field_name' => 'field_test', - 'type' => 'text', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test', - 'bundle' => 'story', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_two', - 'type' => 'integer', - 'cardinality' => -1, - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_two', - 'bundle' => 'story', - ))->save(); - - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_cck_field_values' => array( - array(array(1), array(1)), - ), - 'd6_node' => array( - array(array(1), array(1)), - array(array(2), array(2)), - ), - 'd6_node_revision' => array( - array(array(1), array(1)), - ), - ); - $this->prepareMigrations($id_mappings); - $migrations = entity_load_multiple('migration', array('d6_cck_field_revision:*')); - foreach ($migrations as $migration) { - $executable = new MigrateExecutable($migration, $this); - $executable->import(); - } - } - - /** - * Test CCK revision migration from Drupal 6 to 8. - */ - public function testCckFieldRevision() { - $node = \Drupal::entityManager()->getStorage('node')->loadRevision(2); - $this->assertIdentical('1', $node->id(), 'Node 1 loaded.'); - $this->assertIdentical('2', $node->getRevisionId(), 'Node 1 revision 2loaded.'); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php deleted file mode 100644 index 02e54602c..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php +++ /dev/null @@ -1,210 +0,0 @@ -installEntitySchema('file'); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test', - 'type' => 'text', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test', - 'bundle' => 'story', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_two', - 'type' => 'integer', - 'cardinality' => -1, - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_two', - 'bundle' => 'story', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_three', - 'type' => 'decimal', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_three', - 'bundle' => 'story', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_integer_selectlist', - 'type' => 'integer', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_integer_selectlist', - 'bundle' => 'story', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_exclude_unset', - 'type' => 'text', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_exclude_unset', - 'bundle' => 'story', - ))->save(); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_multivalue', - 'type' => 'decimal', - 'precision' => '10', - 'scale' => '2', - 'cardinality' => -1, - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_multivalue', - 'bundle' => 'test_planet', - ))->save(); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_identical1', - 'type' => 'integer', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_identical1', - 'bundle' => 'story', - ))->save(); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_identical2', - 'type' => 'integer', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_identical2', - 'bundle' => 'story', - ))->save(); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_link', - 'type' => 'link', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_link', - 'bundle' => 'story', - ))->save(); - - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_filefield', - 'type' => 'file', - ))->save(); - entity_create('field_config', array( - 'entity_type' => 'node', - 'field_name' => 'field_test_filefield', - 'bundle' => 'story', - ))->save(); - - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_field_formatter_settings' => array( - array(array('page', 'default', 'node', 'field_test'), array('node', 'page', 'default', 'field_test')), - ), - 'd6_field_instance_widget_settings' => array( - array(array('page', 'field_test'), array('node', 'page', 'default', 'test')), - ), - 'd6_node' => array( - array(array(1), array(1)), - array(array(2), array(2)), - array(array(3), array(3)), - ), - ); - $this->prepareMigrations($id_mappings); - - $migrations = entity_load_multiple('migration', array('d6_cck_field_values:*')); - foreach ($migrations as $migration) { - $executable = new MigrateExecutable($migration, $this); - $executable->import(); - } - - } - - /** - * Test CCK migration from Drupal 6 to 8. - */ - public function testCckFields() { - $node = Node::load(1); - - $this->assertIdentical('This is a shared text field', $node->field_test->value); - $this->assertIdentical('filtered_html', $node->field_test->format); - $this->assertIdentical('10', $node->field_test_two->value); - $this->assertIdentical('20', $node->field_test_two[1]->value); - - $this->assertIdentical('42.42', $node->field_test_three->value, 'Single field second value is correct.'); - $this->assertIdentical('3412', $node->field_test_integer_selectlist[0]->value); - $this->assertIdentical('1', $node->field_test_identical1->value, 'Integer value is correct'); - $this->assertIdentical('1', $node->field_test_identical2->value, 'Integer value is correct'); - $this->assertIdentical('This is a field with exclude unset.', $node->field_test_exclude_unset->value, 'Field with exclude unset is correct.'); - - // Test that link fields are migrated. - $this->assertIdentical('https://www.drupal.org/project/drupal', $node->field_test_link->uri); - $this->assertIdentical('Drupal project page', $node->field_test_link->title); - $this->assertIdentical(['target' => '_blank'], $node->field_test_link->options['attributes']); - - // Test the file field meta. - $this->assertIdentical('desc', $node->field_test_filefield->description); - $this->assertIdentical('5', $node->field_test_filefield->target_id); - - $planet_node = Node::load(3); - $value_1 = $planet_node->field_multivalue->value; - $value_2 = $planet_node->field_multivalue[1]->value; - - // SQLite does not support scales for float data types so we need to convert - // the value manually. - if ($this->container->get('database')->driver() == 'sqlite') { - $value_1 = sprintf('%01.2f', $value_1); - $value_2 = sprintf('%01.2f', $value_2); - } - $this->assertIdentical('33.00', $value_1); - $this->assertIdentical('44.00', $value_2); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php deleted file mode 100644 index a6efb8e24..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php +++ /dev/null @@ -1,96 +0,0 @@ -installEntitySchema('node'); - $this->installEntitySchema('comment'); - $this->installConfig(['node', 'comment']); - - entity_create('node_type', array('type' => 'page'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - $this->addDefaultCommentField('node', 'story'); - $this->container->get('entity.manager')->getStorage('comment_type')->create(array( - 'id' => 'comment_no_subject', - 'label' => 'comment_no_subject', - 'target_entity_type_id' => 'node', - ))->save(); - \Drupal::service('comment.manager')->addBodyField('comment_no_subject'); - - $node = entity_create('node', array( - 'type' => 'story', - 'nid' => 1, - )); - $node->enforceIsNew(); - $node->save(); - $id_mappings = array( - 'd6_filter_format' => array(array(array(1), array('filtered_html'))), - 'd6_node' => array(array(array(1), array(1))), - 'd6_user' => array(array(array(0), array(0))), - 'd6_comment_type' => array(array(array('comment'), array('comment_no_subject'))), - 'd6_comment_entity_display' => array(array(array('story'), array('node', 'story', 'default', 'comment'))), - 'd6_comment_entity_form_display' => array(array(array('story'), array('node', 'story', 'default', 'comment'))), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps([ - 'Node.php', - 'NodeRevisions.php', - 'ContentTypeStory.php', - 'ContentTypeTestPlanet.php', - 'Variable.php', - 'NodeType.php', - 'Comments.php', - ]); - $this->executeMigration('d6_comment'); - } - - /** - * Tests the Drupal 6 to Drupal 8 comment migration. - */ - public function testComments() { - /** @var \Drupal\Core\Entity\EntityStorageInterface $comment_storage */ - $comment_storage = $this->container->get('entity.manager')->getStorage('comment'); - /** @var \Drupal\comment\CommentInterface $comment */ - $comment = $comment_storage->load(1); - $this->assertIdentical('The first comment.', $comment->getSubject()); - $this->assertIdentical('The first comment body.', $comment->comment_body->value); - $this->assertIdentical('filtered_html', $comment->comment_body->format); - $this->assertIdentical('0', $comment->pid->target_id); - $this->assertIdentical('1', $comment->getCommentedEntityId()); - $this->assertIdentical('node', $comment->getCommentedEntityTypeId()); - $this->assertIdentical('en', $comment->language()->getId()); - $this->assertIdentical('comment_no_subject', $comment->getTypeId()); - - $comment = $comment_storage->load(2); - $this->assertIdentical('The response to the second comment.', $comment->subject->value); - $this->assertIdentical('3', $comment->pid->target_id); - - $comment = $comment_storage->load(3); - $this->assertIdentical('The second comment.', $comment->subject->value); - $this->assertIdentical('0', $comment->pid->target_id); - } -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php deleted file mode 100644 index 2b4e07de4..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php +++ /dev/null @@ -1,45 +0,0 @@ -installEntitySchema('node'); - $this->installEntitySchema('comment'); - $this->installConfig(['node', 'comment']); - - $this->loadDumps(['Variable.php', 'NodeType.php']); - $this->executeMigration('d6_comment_type'); - } - - /** - * Tests the Drupal 6 to Drupal 8 comment type migration. - */ - public function testCommentType() { - $comment_type = CommentType::load('comment'); - $this->assertIdentical('node', $comment_type->getTargetEntityTypeId()); - $comment_type = CommentType::load('comment_no_subject'); - $this->assertIdentical('node', $comment_type->getTargetEntityTypeId()); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableDisplayBase.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableDisplayBase.php deleted file mode 100644 index e3a0e9003..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableDisplayBase.php +++ /dev/null @@ -1,70 +0,0 @@ - 'node', - 'field_name' => 'comment', - 'type' => 'comment', - 'translatable' => '0', - ))->save(); - foreach ($this->types as $type) { - entity_create('node_type', array('type' => $type))->save(); - entity_create('field_config', array( - 'label' => 'Comments', - 'description' => '', - 'field_name' => 'comment', - 'entity_type' => 'node', - 'bundle' => $type, - 'required' => 1, - ))->save(); - } - $id_mappings = array( - 'd6_comment_field_instance' => array( - array(array('page'), array('node', 'comment', 'page')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->loadDumps(['Variable.php', 'NodeType.php']); - $this->executeMigration(static::MIGRATION); - - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityDisplayTest.php deleted file mode 100644 index f63326b06..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityDisplayTest.php +++ /dev/null @@ -1,38 +0,0 @@ -types as $type) { - $component = entity_get_display('node', $type, 'default')->getComponent('comment'); - $this->assertIdentical('hidden', $component['label']); - $this->assertIdentical('comment_default', $component['type']); - $this->assertIdentical(20, $component['weight']); - } - } -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplaySubjectTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplaySubjectTest.php deleted file mode 100644 index a65c9fc85..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplaySubjectTest.php +++ /dev/null @@ -1,60 +0,0 @@ - $comment_type, - 'target_entity_type_id' => 'node', - )) - ->save(); - } - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_comment_type' => array( - array(array('comment'), array('comment_no_subject')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->loadDumps(['Variable.php', 'NodeType.php']); - $this->executeMigration('d6_comment_entity_form_display_subject'); - } - - /** - * Tests comment subject variable migrated into an entity display. - */ - public function testCommentEntityFormDisplay() { - $component = entity_get_form_display('comment', 'comment', 'default') - ->getComponent('subject'); - $this->assertIdentical('string_textfield', $component['type']); - $this->assertIdentical(10, $component['weight']); - $component = entity_get_form_display('comment', 'comment_no_subject', 'default') - ->getComponent('subject'); - $this->assertNull($component); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplayTest.php deleted file mode 100644 index 79d8dde15..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplayTest.php +++ /dev/null @@ -1,33 +0,0 @@ -types as $type) { - $component = entity_get_form_display('node', $type, 'default')->getComponent('comment'); - $this->assertIdentical('comment_default', $component['type']); - $this->assertIdentical(20, $component['weight']); - } - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableFieldTest.php deleted file mode 100644 index c3986baf0..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableFieldTest.php +++ /dev/null @@ -1,54 +0,0 @@ - $type))->save(); - } - foreach (['comment', 'comment_no_subject'] as $comment_type) { - entity_create('comment_type', array( - 'id' => $comment_type, - 'target_entity_type_id' => 'node', - )) - ->save(); - } - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_comment_type' => array( - array(array('comment'), array('comment_no_subject')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->loadDumps(['Variable.php', 'NodeType.php']); - $this->executeMigration('d6_comment_field'); - } - - /** - * Tests comment variables migrated into a field entity. - */ - public function testCommentField() { - $this->assertTrue(is_object(FieldStorageConfig::load('node.comment'))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableInstanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableInstanceTest.php deleted file mode 100644 index 22747ead6..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableInstanceTest.php +++ /dev/null @@ -1,79 +0,0 @@ - array( - array(array('page'), array('node', 'page')), - ), - 'd6_node_type' => array( - array(array('page'), array('page')), - ), - ); - $this->prepareMigrations($id_mappings); - - foreach (array('page', 'story', 'article') as $type) { - entity_create('node_type', array('type' => $type))->save(); - } - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'comment', - 'type' => 'comment', - 'translatable' => '0', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'comment_no_subject', - 'type' => 'comment', - 'translatable' => '0', - ))->save(); - $this->loadDumps(['Variable.php', 'NodeType.php']); - $this->executeMigration('d6_comment_field_instance'); - } - - /** - * Test the migrated field instance values. - */ - public function testCommentFieldInstance() { - $node = entity_create('node', array('type' => 'page')); - $this->assertIdentical(0, $node->comment->status); - $this->assertIdentical('comment', $node->comment->getFieldDefinition()->getName()); - $settings = $node->comment->getFieldDefinition()->getSettings(); - $this->assertIdentical(4, $settings['default_mode']); - $this->assertIdentical(50, $settings['per_page']); - $this->assertIdentical(0, $settings['anonymous']); - $this->assertIdentical(FALSE, $settings['form_location']); - $this->assertIdentical(1, $settings['preview']); - - $node = entity_create('node', array('type' => 'story')); - $this->assertIdentical(2, $node->comment_no_subject->status); - $this->assertIdentical('comment_no_subject', $node->comment_no_subject->getFieldDefinition()->getName()); - $settings = $node->comment_no_subject->getFieldDefinition()->getSettings(); - $this->assertIdentical(2, $settings['default_mode']); - $this->assertIdentical(70, $settings['per_page']); - $this->assertIdentical(1, $settings['anonymous']); - $this->assertIdentical(FALSE, $settings['form_location']); - $this->assertIdentical(0, $settings['preview']); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php deleted file mode 100644 index 15169545c..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php +++ /dev/null @@ -1,235 +0,0 @@ -installConfig(['node']); - - entity_create('node_type', array('type' => 'test_page'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - // Create the node preview view mode. - EntityViewMode::create(array('id' => 'node.preview', 'targetEntityType' => 'node'))->save(); - - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_view_modes' => array( - array(array(1), array('node', 'preview')), - array(array(4), array('node', 'rss')), - array(array('teaser'), array('node', 'teaser')), - array(array('full'), array('node', 'full')), - ), - 'd6_field_instance' => array( - array(array('fieldname', 'page'), array('node', 'fieldname', 'page')), - ), - 'd6_field' => array( - array(array('field_test'), array('node', 'field_test')), - array(array('field_test_two'), array('node', 'field_test_two')), - array(array('field_test_three'), array('node', 'field_test_three')), - array(array('field_test_email'), array('node', 'field_test_email')), - array(array('field_test_link'), array('node', 'field_test_link')), - array(array('field_test_filefield'), array('node', 'field_test_filefield')), - array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), - array(array('field_test_phone'), array('node', 'field_test_phone')), - array(array('field_test_date'), array('node', 'field_test_date')), - array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), - array(array('field_test_datetime'), array('node', 'field_test_datetime')), - array(array('field_test_exclude_unset'), array('node', 'field_test_exclude_unset')), - ), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps([ - 'ContentNodeFieldInstance.php', - 'ContentNodeField.php', - 'ContentFieldTest.php', - 'ContentFieldTestTwo.php', - 'ContentFieldMultivalue.php', - ]); - $this->executeMigration('d6_field_formatter_settings'); - } - - /** - * Test that migrated entity display settings can be loaded using D8 API's. - */ - public function testEntityDisplaySettings() { - // Run tests. - $field_name = "field_test"; - $expected = array( - 'label' => 'above', - 'weight' => 1, - 'type' => 'text_trimmed', - 'settings' => array('trim_length' => 600), - 'third_party_settings' => array(), - ); - - // Can we load any entity display. - $display = entity_load('entity_view_display', 'node.story.teaser'); - $this->assertIdentical($expected, $display->getComponent($field_name)); - - // Test migrate worked with multiple bundles. - $display = entity_load('entity_view_display', 'node.test_page.teaser'); - $expected['weight'] = 35; - $this->assertIdentical($expected, $display->getComponent($field_name)); - - // Test RSS because that has been converted from 4 to rss. - $display = entity_load('entity_view_display', 'node.story.rss'); - $expected['weight'] = 1; - $this->assertIdentical($expected, $display->getComponent($field_name)); - - // Test the default format with text_default which comes from a static map. - $expected['type'] = 'text_default'; - $expected['settings'] = array(); - $display = entity_load('entity_view_display', 'node.story.default'); - $this->assertIdentical($expected, $display->getComponent($field_name)); - - // Check that we can migrate multiple fields. - $content = $display->get('content'); - $this->assertTrue(isset($content['field_test']), 'Settings for field_test exist.'); - $this->assertTrue(isset($content['field_test_two']), "Settings for field_test_two exist."); - - // Check that we can migrate a field where exclude is not set. - $this->assertTrue(isset($content['field_test_exclude_unset']), "Settings for field_test_exclude_unset exist."); - - // Test the number field formatter settings are correct. - $expected['weight'] = 1; - $expected['type'] = 'number_integer'; - $expected['settings'] = array( - 'thousand_separator' => ',', - 'prefix_suffix' => TRUE, - ); - $component = $display->getComponent('field_test_two'); - $this->assertIdentical($expected, $component); - $expected['weight'] = 2; - $expected['type'] = 'number_decimal'; - $expected['settings'] = array( - 'scale' => 2, - 'decimal_separator' => '.', - 'thousand_separator' => ',', - 'prefix_suffix' => TRUE, - ); - $component = $display->getComponent('field_test_three'); - $this->assertIdentical($expected, $component); - - // Test the email field formatter settings are correct. - $expected['weight'] = 6; - $expected['type'] = 'email_mailto'; - $expected['settings'] = array(); - $component = $display->getComponent('field_test_email'); - $this->assertIdentical($expected, $component); - - // Test the link field formatter settings. - $expected['weight'] = 7; - $expected['type'] = 'link'; - $expected['settings'] = array( - 'trim_length' => 80, - 'url_only' => TRUE, - 'url_plain' => TRUE, - 'rel' => '0', - 'target' => '0', - ); - $component = $display->getComponent('field_test_link'); - $this->assertIdentical($expected, $component); - $expected['settings']['url_only'] = FALSE; - $expected['settings']['url_plain'] = FALSE; - $display = entity_load('entity_view_display', 'node.story.teaser'); - $component = $display->getComponent('field_test_link'); - $this->assertIdentical($expected, $component); - - // Test the file field formatter settings. - $expected['weight'] = 8; - $expected['type'] = 'file_default'; - $expected['settings'] = array(); - $component = $display->getComponent('field_test_filefield'); - $this->assertIdentical($expected, $component); - $display = entity_load('entity_view_display', 'node.story.default'); - $expected['type'] = 'file_url_plain'; - $component = $display->getComponent('field_test_filefield'); - $this->assertIdentical($expected, $component); - - // Test the image field formatter settings. - $expected['weight'] = 9; - $expected['type'] = 'image'; - $expected['settings'] = array('image_style' => '', 'image_link' => ''); - $component = $display->getComponent('field_test_imagefield'); - $this->assertIdentical($expected, $component); - $display = entity_load('entity_view_display', 'node.story.teaser'); - $expected['settings']['image_link'] = 'file'; - $component = $display->getComponent('field_test_imagefield'); - $this->assertIdentical($expected, $component); - - // Test phone field. - $expected['weight'] = 13; - $expected['type'] = 'basic_string'; - $expected['settings'] = array(); - $component = $display->getComponent('field_test_phone'); - $this->assertIdentical($expected, $component); - - // Test date field. - $defaults = array('format_type' => 'fallback', 'timezone_override' => '',); - $expected['weight'] = 10; - $expected['type'] = 'datetime_default'; - $expected['settings'] = array('format_type' => 'fallback') + $defaults; - $component = $display->getComponent('field_test_date'); - $this->assertIdentical($expected, $component); - $display = entity_load('entity_view_display', 'node.story.default'); - $expected['settings']['format_type'] = 'long'; - $component = $display->getComponent('field_test_date'); - $this->assertIdentical($expected, $component); - - // Test date stamp field. - $expected['weight'] = 11; - $expected['settings']['format_type'] = 'fallback'; - $component = $display->getComponent('field_test_datestamp'); - $this->assertIdentical($expected, $component); - $display = entity_load('entity_view_display', 'node.story.teaser'); - $expected['settings'] = array('format_type' => 'medium') + $defaults; - $component = $display->getComponent('field_test_datestamp'); - $this->assertIdentical($expected, $component); - - // Test datetime field. - $expected['weight'] = 12; - $expected['settings'] = array('format_type' => 'short') + $defaults; - $component = $display->getComponent('field_test_datetime'); - $this->assertIdentical($expected, $component); - $display = entity_load('entity_view_display', 'node.story.default'); - $expected['settings']['format_type'] = 'fallback'; - $component = $display->getComponent('field_test_datetime'); - $this->assertIdentical($expected, $component); - - // Test a date field with a random format which should be mapped - // to datetime_default. - $display = entity_load('entity_view_display', 'node.story.rss'); - $expected['settings']['format_type'] = 'fallback'; - $component = $display->getComponent('field_test_datetime'); - $this->assertIdentical($expected, $component); - // Test that our Id map has the correct data. - $this->assertIdentical(array('node', 'story', 'teaser', 'field_test'), entity_load('migration', 'd6_field_formatter_settings')->getIdMap()->lookupDestinationID(array('story', 'teaser', 'node', 'field_test'))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldInstanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldInstanceTest.php deleted file mode 100644 index bae1e8548..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldInstanceTest.php +++ /dev/null @@ -1,181 +0,0 @@ - array( - array(array('field_test'), array('node', 'field_test')), - array(array('field_test_two'), array('node', 'field_test_two')), - array(array('field_test_three'), array('node', 'field_test_three')), - array(array('field_test_four'), array('node', 'field_test_four')), - array(array('field_test_email'), array('node', 'field_test_email')), - array(array('field_test_link'), array('node', 'field_test_link')), - array(array('field_test_filefield'), array('node', 'field_test_filefield')), - array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), - array(array('field_test_phone'), array('node', 'field_test_phone')), - array(array('field_test_date'), array('node', 'field_test_date')), - array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), - array(array('field_test_datetime'), array('node', 'field_test_datetime')), - ), - 'd6_node_type' => array( - array(array('page'), array('page')), - array(array('story'), array('story')), - array(array('test_page'), array('test_page')), - ), - ); - $this->prepareMigrations($id_mappings); - entity_create('node_type', array('type' => 'page'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - entity_create('node_type', array('type' => 'test_page'))->save(); - - $this->loadDumps([ - 'ContentNodeFieldInstance.php', - 'ContentNodeField.php', - 'ContentFieldTest.php', - 'ContentFieldTestTwo.php', - 'ContentFieldMultivalue.php', - ]); - $this->createFields(); - $this->executeMigration('d6_field_instance'); - } - - /** - * Tests migration of file variables to file.settings.yml. - */ - public function testFieldInstanceSettings() { - $entity = entity_create('node', array('type' => 'story')); - // Test a text field. - $field = FieldConfig::load('node.story.field_test'); - $this->assertIdentical('Text Field', $field->label()); - $expected = array('max_length' => 255); - $this->assertIdentical($expected, $field->getSettings()); - $this->assertIdentical('text for default value', $entity->field_test->value); - - // Test a number field. - $field = FieldConfig::load('node.story.field_test_two'); - $this->assertIdentical('Integer Field', $field->label()); - $expected = array( - 'min' => 10, - 'max' => 100, - 'prefix' => 'pref', - 'suffix' => 'suf', - 'unsigned' => FALSE, - 'size' => 'normal', - ); - $this->assertIdentical($expected, $field->getSettings()); - - $field = FieldConfig::load('node.story.field_test_four'); - $this->assertIdentical('Float Field', $field->label()); - $expected = array( - 'min' => 100.0, - 'max' => 200.0, - 'prefix' => 'id-', - 'suffix' => '', - ); - $this->assertIdentical($expected, $field->getSettings()); - - // Test email field. - $field = FieldConfig::load('node.story.field_test_email'); - $this->assertIdentical('Email Field', $field->label()); - $this->assertIdentical('benjy@example.com', $entity->field_test_email->value); - - // Test a filefield. - $field = FieldConfig::load('node.story.field_test_filefield'); - $this->assertIdentical('File Field', $field->label()); - $expected = array( - 'file_extensions' => 'txt pdf doc', - 'file_directory' => 'images', - 'description_field' => TRUE, - 'max_filesize' => '200KB', - 'target_type' => 'file', - 'display_field' => FALSE, - 'display_default' => FALSE, - 'uri_scheme' => 'public', - // This value should be 'default:file' but the test does not migrate field - // storages so we end up with the default value for this setting. - 'handler' => 'default:node', - 'handler_settings' => array(), - 'target_bundle' => NULL, - ); - $field_settings = $field->getSettings(); - ksort($expected); - ksort($field_settings); - // This is the only way to compare arrays. - $this->assertIdentical($expected, $field_settings); - - // Test a link field. - $field = FieldConfig::load('node.story.field_test_link'); - $this->assertIdentical('Link Field', $field->label()); - $expected = array('title' => 2, 'link_type' => LinkItemInterface::LINK_GENERIC); - $this->assertIdentical($expected, $field->getSettings()); - $this->assertIdentical('default link title', $entity->field_test_link->title, 'Field field_test_link default title is correct.'); - $this->assertIdentical('https://www.drupal.org', $entity->field_test_link->url, 'Field field_test_link default title is correct.'); - $this->assertIdentical([], $entity->field_test_link->options['attributes']); - } - - /** - * Helper to create fields. - */ - protected function createFields() { - $fields = array( - 'field_test' => 'text', - 'field_test_two' => 'integer', - 'field_test_three' => 'decimal', - 'field_test_four' => 'float', - 'field_test_email' => 'email', - 'field_test_link' => 'link', - 'field_test_filefield' => 'file', - 'field_test_imagefield' => 'image', - 'field_test_phone' => 'telephone', - 'field_test_date' => 'datetime', - 'field_test_datestamp' => 'datetime', - 'field_test_datetime' => 'datetime', - ); - foreach ($fields as $name => $type) { - entity_create('field_storage_config', array( - 'field_name' => $name, - 'entity_type' => 'node', - 'type' => $type, - ))->save(); - } - - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php deleted file mode 100644 index 1b612b088..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php +++ /dev/null @@ -1,113 +0,0 @@ -loadDumps([ - 'ContentNodeFieldInstance.php', - 'ContentNodeField.php', - 'ContentFieldTest.php', - 'ContentFieldTestTwo.php', - 'ContentFieldMultivalue.php', - ]); - $this->executeMigration('d6_field'); - } - - /** - * Tests the Drupal 6 field to Drupal 8 migration. - */ - public function testFields() { - // Text field. - /** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */ - $field_storage = FieldStorageConfig::load('node.field_test'); - $expected = array('max_length' => 255); - $this->assertIdentical("text", $field_storage->getType(), t('Field type is @fieldtype. It should be text.', array('@fieldtype' => $field_storage->getType()))); - $this->assertIdentical($expected, $field_storage->getSettings(), "Field type text settings are correct"); - - // Integer field. - $field_storage = FieldStorageConfig::load('node.field_test_two'); - $this->assertIdentical("integer", $field_storage->getType(), t('Field type is @fieldtype. It should be integer.', array('@fieldtype' => $field_storage->getType()))); - - // Float field. - $field_storage = FieldStorageConfig::load('node.field_test_three'); - $this->assertIdentical("decimal", $field_storage->getType(), t('Field type is @fieldtype. It should be decimal.', array('@fieldtype' => $field_storage->getType()))); - - // Link field. - $field_storage = FieldStorageConfig::load('node.field_test_link'); - $this->assertIdentical("link", $field_storage->getType(), t('Field type is @fieldtype. It should be link.', array('@fieldtype' => $field_storage->getType()))); - - // File field. - $field_storage = FieldStorageConfig::load('node.field_test_filefield'); - $this->assertIdentical("file", $field_storage->getType(), t('Field type is @fieldtype. It should be file.', array('@fieldtype' => $field_storage->getType()))); - - $field_storage = FieldStorageConfig::load('node.field_test_imagefield'); - $this->assertIdentical("image", $field_storage->getType(), t('Field type is @fieldtype. It should be image.', array('@fieldtype' => $field_storage->getType()))); - $settings = $field_storage->getSettings(); - $this->assertIdentical('file', $settings['target_type']); - $this->assertIdentical('public', $settings['uri_scheme']); - $this->assertIdentical(array(), array_filter($settings['default_image'])); - - // Phone field. - $field_storage = FieldStorageConfig::load('node.field_test_phone'); - $this->assertIdentical("telephone", $field_storage->getType(), t('Field type is @fieldtype. It should be telephone.', array('@fieldtype' => $field_storage->getType()))); - - // Date field. - $field_storage = FieldStorageConfig::load('node.field_test_datetime'); - $this->assertIdentical("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', array('@fieldtype' => $field_storage->getType()))); - - // Decimal field with radio buttons. - $field_storage = FieldStorageConfig::load('node.field_test_decimal_radio_buttons'); - $this->assertIdentical("list_float", $field_storage->getType(), t('Field type is @fieldtype. It should be list_float.', array('@fieldtype' => $field_storage->getType()))); - $this->assertNotNull($field_storage->getSetting('allowed_values')['1.2'], t('First allowed value key is set to 1.2')); - $this->assertNotNull($field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value key is set to 2.1')); - $this->assertIdentical('1.2', $field_storage->getSetting('allowed_values')['1.2'], t('First allowed value is set to 1.2')); - $this->assertIdentical('2.1', $field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value is set to 1.2')); - - // Float field with a single checkbox. - $field_storage = FieldStorageConfig::load('node.field_test_float_single_checkbox'); - $this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType()))); - - // Integer field with a select list. - $field_storage = FieldStorageConfig::load('node.field_test_integer_selectlist'); - $this->assertIdentical("list_integer", $field_storage->getType(), t('Field type is @fieldtype. It should be list_integer.', array('@fieldtype' => $field_storage->getType()))); - $this->assertNotNull($field_storage->getSetting('allowed_values')['1234'], t('First allowed value key is set to 1234')); - $this->assertNotNull($field_storage->getSetting('allowed_values')['2341'], t('Second allowed value key is set to 2341')); - $this->assertNotNull($field_storage->getSetting('allowed_values')['3412'], t('Third allowed value key is set to 3412')); - $this->assertNotNull($field_storage->getSetting('allowed_values')['4123'], t('Fourth allowed value key is set to 4123')); - $this->assertIdentical('1234', $field_storage->getSetting('allowed_values')['1234'], t('First allowed value is set to 1234')); - $this->assertIdentical('2341', $field_storage->getSetting('allowed_values')['2341'], t('Second allowed value is set to 2341')); - $this->assertIdentical('3412', $field_storage->getSetting('allowed_values')['3412'], t('Third allowed value is set to 3412')); - $this->assertIdentical('4123', $field_storage->getSetting('allowed_values')['4123'], t('Fourth allowed value is set to 4123')); - - // Text field with a single checkbox. - $field_storage = FieldStorageConfig::load('node.field_test_text_single_checkbox'); - $this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType()))); - - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldWidgetSettingsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldWidgetSettingsTest.php deleted file mode 100644 index cc1540d9d..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldWidgetSettingsTest.php +++ /dev/null @@ -1,149 +0,0 @@ - 'test_page'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_field_instance' => array( - array(array('fieldname', 'page'), array('node', 'fieldname', 'page')), - ), - 'd6_field' => array( - array(array('field_test'), array('node', 'field_test')), - array(array('field_test_two'), array('node', 'field_test_two')), - array(array('field_test_three'), array('node', 'field_test_three')), - array(array('field_test_email'), array('node', 'field_test_email')), - array(array('field_test_link'), array('node', 'field_test_link')), - array(array('field_test_filefield'), array('node', 'field_test_filefield')), - array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), - array(array('field_test_phone'), array('node', 'field_test_phone')), - array(array('field_test_date'), array('node', 'field_test_date')), - array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), - array(array('field_test_datetime'), array('node', 'field_test_datetime')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->loadDumps([ - 'ContentNodeFieldInstance.php', - 'ContentNodeField.php', - 'ContentFieldTest.php', - 'ContentFieldTestTwo.php', - 'ContentFieldMultivalue.php', - ]); - $this->executeMigration('d6_field_instance_widget_settings'); - } - - /** - * Test that migrated view modes can be loaded using D8 API's. - */ - public function testWidgetSettings() { - // Test the config can be loaded. - $form_display = entity_load('entity_form_display', 'node.story.default'); - $this->assertIdentical(FALSE, is_null($form_display), "Form display node.story.default loaded with config."); - - // Text field. - $component = $form_display->getComponent('field_test'); - $expected = array('weight' => 1, 'type' => 'text_textfield'); - $expected['settings'] = array('size' => 60, 'placeholder' => ''); - $expected['third_party_settings'] = array(); - $this->assertIdentical($expected, $component, 'Text field settings are correct.'); - - // Integer field. - $component = $form_display->getComponent('field_test_two'); - $expected['type'] = 'number'; - $expected['weight'] = 1; - $expected['settings'] = array('placeholder' => ''); - $this->assertIdentical($expected, $component); - - // Float field. - $component = $form_display->getComponent('field_test_three'); - $expected['weight'] = 2; - $this->assertIdentical($expected, $component); - - // Email field. - $component = $form_display->getComponent('field_test_email'); - $expected['type'] = 'email_default'; - $expected['weight'] = 6; - $this->assertIdentical($expected, $component); - - // Link field. - $component = $form_display->getComponent('field_test_link'); - $this->assertIdentical('link_default', $component['type']); - $this->assertIdentical(7, $component['weight']); - $this->assertFalse(array_filter($component['settings'])); - - // File field. - $component = $form_display->getComponent('field_test_filefield'); - $expected['type'] = 'file_generic'; - $expected['weight'] = 8; - $expected['settings'] = array('progress_indicator' => 'bar'); - $this->assertIdentical($expected, $component); - - // Image field. - $component = $form_display->getComponent('field_test_imagefield'); - $expected['type'] = 'image_image'; - $expected['weight'] = 9; - $expected['settings'] = array('progress_indicator' => 'bar', 'preview_image_style' => 'thumbnail'); - $this->assertIdentical($expected, $component); - - // Phone field. - $component = $form_display->getComponent('field_test_phone'); - $expected['type'] = 'telephone_default'; - $expected['weight'] = 13; - $expected['settings'] = array('placeholder' => ''); - $this->assertIdentical($expected, $component); - - // Date fields. - $component = $form_display->getComponent('field_test_date'); - $expected['type'] = 'datetime_default'; - $expected['weight'] = 10; - $expected['settings'] = array(); - $this->assertIdentical($expected, $component); - - $component = $form_display->getComponent('field_test_datestamp'); - $expected['weight'] = 11; - $this->assertIdentical($expected, $component); - - $component = $form_display->getComponent('field_test_datetime'); - $expected['weight'] = 12; - $this->assertIdentical($expected, $component); - - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php deleted file mode 100644 index 4e974a03e..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php +++ /dev/null @@ -1,48 +0,0 @@ -loadDumps(['Variable.php']); - $this->executeMigration('d6_file_settings'); - } - - /** - * Tests migration of file variables to file.settings.yml. - */ - public function testFileSettings() { - $config = $this->config('file.settings'); - $this->assertIdentical('textfield', $config->get('description.type')); - $this->assertIdentical(128, $config->get('description.length')); - $this->assertIdentical('sites/default/files/icons', $config->get('icon.directory')); - $this->assertConfigSchema(\Drupal::service('config.typed'), 'file.settings', $config->get()); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php deleted file mode 100644 index fa4d5c832..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php +++ /dev/null @@ -1,132 +0,0 @@ -installEntitySchema('file'); - $this->installConfig(['file']); - - $this->loadDumps(['Files.php']); - /** @var \Drupal\migrate\Entity\MigrationInterface $migration */ - $migration = entity_load('migration', 'd6_file'); - $source = $migration->get('source'); - $source['site_path'] = 'core/modules/simpletest'; - $migration->set('source', $source); - $this->executeMigration($migration); - $this->standalone = TRUE; - } - - /** - * Tests the Drupal 6 files to Drupal 8 migration. - */ - public function testFiles() { - /** @var \Drupal\file\FileInterface $file */ - $file = File::load(1); - $this->assertIdentical('Image1.png', $file->getFilename()); - $this->assertIdentical('39325', $file->getSize()); - $this->assertIdentical('public://image-1.png', $file->getFileUri()); - $this->assertIdentical('image/png', $file->getMimeType()); - $this->assertIdentical("1", $file->getOwnerId()); - - // It is pointless to run the second half from MigrateDrupal6Test. - if (empty($this->standalone)) { - return; - } - - // Test that we can re-import and also test with file_directory_path set. - db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute(); - - $this->loadDumps(['Variable.php']); - - // Update the file_directory_path. - Database::getConnection('default', 'migrate') - ->update('variable') - ->fields(array('value' => serialize('files/test'))) - ->condition('name', 'file_directory_path') - ->execute(); - Database::getConnection('default', 'migrate') - ->update('variable') - ->fields(array('value' => serialize($this->getTempFilesDirectory()))) - ->condition('name', 'file_directory_temp') - ->execute(); - - $migration = entity_load_unchanged('migration', 'd6_file'); - $this->executeMigration($migration); - - $file = File::load(2); - $this->assertIdentical('public://core/modules/simpletest/files/image-2.jpg', $file->getFileUri()); - - // Ensure that a temporary file has been migrated. - $file = File::load(6); - $this->assertIdentical('temporary://' . static::getUniqueFilename(), $file->getFileUri()); - } - - /** - * @return string - * A filename based upon the test. - */ - public static function getUniqueFilename() { - return static::$tempFilename; - } - - /** - * {@inheritdoc} - */ - public static function migrateDumpAlter(TestBase $test) { - // Creates a random filename and updates the source database. - $random = new Random(); - $temp_directory = $test->getTempFilesDirectory(); - file_prepare_directory($temp_directory, FILE_CREATE_DIRECTORY); - static::$tempFilename = $test->getDatabasePrefix() . $random->name() . '.jpg'; - $file_path = $temp_directory . '/' . static::$tempFilename; - file_put_contents($file_path, ''); - Database::getConnection('default', 'migrate') - ->update('files') - ->condition('fid', 6) - ->fields(array( - 'filename' => static::$tempFilename, - 'filepath' => $file_path, - )) - ->execute(); - - return static::$tempFilename; - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadBase.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadBase.php deleted file mode 100644 index b39211672..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadBase.php +++ /dev/null @@ -1,100 +0,0 @@ -installEntitySchema('file'); - $this->installEntitySchema('node'); - $this->installSchema('file', ['file_usage']); - $this->installSchema('node', ['node_access']); - - // Create new file entities. - for ($i = 1; $i <= 3; $i++) { - $file = entity_create('file', array( - 'fid' => $i, - 'uid' => 1, - 'filename' => 'druplicon.txt', - 'uri' => "public://druplicon-$i.txt", - 'filemime' => 'text/plain', - 'created' => 1, - 'changed' => 1, - 'status' => FILE_STATUS_PERMANENT, - )); - $file->enforceIsNew(); - file_put_contents($file->getFileUri(), 'hello world'); - - // Save it, inserting a new record. - $file->save(); - $id_mappings['d6_file'][] = array(array($i), array($i)); - } - - // Add a node type. - $node_type = entity_create('node_type', array('type' => 'story')); - $node_type->save(); - - // Add a file field. - entity_create('field_storage_config', array( - 'field_name' => 'upload', - 'entity_type' => 'node', - 'type' => 'file', - 'cardinality' => -1, - 'settings' => array( - 'display_field' => TRUE, - ), - ))->save(); - entity_create('field_config', array( - 'field_name' => 'upload', - 'entity_type' => 'node', - 'bundle' => 'story', - ))->save(); - $id_mappings['d6_node'] = array( - array(array(1), array(1)), - array(array(2), array(2)), - ); - $this->prepareMigrations($id_mappings); - $vids = array(1, 2, 3); - for ($i = 1; $i <= 2; $i++) { - $node = entity_create('node', array( - 'type' => 'story', - 'nid' => $i, - 'vid' => array_shift($vids), - )); - $node->enforceIsNew(); - $node->save(); - if ($i == 1) { - $node->vid->value = array_shift($vids); - $node->enforceIsNew(FALSE); - $node->isDefaultRevision(FALSE); - $node->save(); - } - } - $this->loadDumps([ - 'Node.php', - 'NodeRevisions.php', - 'ContentTypeStory.php', - 'ContentTypeTestPlanet.php', - 'Upload.php', - ]); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityDisplayTest.php deleted file mode 100644 index c48bbbda3..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityDisplayTest.php +++ /dev/null @@ -1,65 +0,0 @@ - 'article'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - entity_create('node_type', array('type' => 'page'))->save(); - - $id_mappings = array( - 'd6_upload_field_instance' => array( - array(array(1), array('node', 'page', 'upload')), - ), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps(['NodeType.php', 'Variable.php']); - $this->executeMigration('d6_upload_entity_display'); - } - - /** - * Tests the Drupal 6 upload settings to Drupal 8 entity display migration. - */ - public function testUploadEntityDisplay() { - $display = entity_get_display('node', 'page', 'default'); - $component = $display->getComponent('upload'); - $this->assertIdentical('file_default', $component['type']); - - $display = entity_get_display('node', 'story', 'default'); - $component = $display->getComponent('upload'); - $this->assertIdentical('file_default', $component['type']); - - // Assure this doesn't exist. - $display = entity_get_display('node', 'article', 'default'); - $component = $display->getComponent('upload'); - $this->assertTrue(is_null($component)); - - $this->assertIdentical(array('node', 'page', 'default', 'upload'), entity_load('migration', 'd6_upload_entity_display')->getIdMap()->lookupDestinationID(array('page'))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityFormDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityFormDisplayTest.php deleted file mode 100644 index 3555fcc62..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadEntityFormDisplayTest.php +++ /dev/null @@ -1,65 +0,0 @@ - 'article'))->save(); - entity_create('node_type', array('type' => 'story'))->save(); - entity_create('node_type', array('type' => 'page'))->save(); - - $id_mappings = array( - 'd6_upload_field_instance' => array( - array(array(1), array('node', 'page', 'upload')), - ), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps(['NodeType.php', 'Variable.php']); - $this->executeMigration('d6_upload_entity_form_display'); - } - - /** - * Tests the Drupal 6 upload settings to Drupal 8 entity form display migration. - */ - public function testUploadEntityFormDisplay() { - $display = entity_get_form_display('node', 'page', 'default'); - $component = $display->getComponent('upload'); - $this->assertIdentical('file_generic', $component['type']); - - $display = entity_get_form_display('node', 'story', 'default'); - $component = $display->getComponent('upload'); - $this->assertIdentical('file_generic', $component['type']); - - // Assure this doesn't exist. - $display = entity_get_form_display('node', 'article', 'default'); - $component = $display->getComponent('upload'); - $this->assertTrue(is_null($component)); - - $this->assertIdentical(array('node', 'page', 'default', 'upload'), entity_load('migration', 'd6_upload_entity_form_display')->getIdMap()->lookupDestinationID(array('page'))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadFieldTest.php deleted file mode 100644 index f4be6e2c4..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadFieldTest.php +++ /dev/null @@ -1,43 +0,0 @@ -executeMigration('d6_upload_field'); - } - - /** - * Tests the Drupal 6 upload settings to Drupal 8 field migration. - */ - public function testUpload() { - $field_storage = FieldStorageConfig::load('node.upload'); - $this->assertIdentical('node.upload', $field_storage->id()); - $this->assertIdentical(array('node', 'upload'), entity_load('migration', 'd6_upload_field')->getIdMap()->lookupDestinationID(array(''))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadInstanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadInstanceTest.php deleted file mode 100644 index b1ce798f3..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadInstanceTest.php +++ /dev/null @@ -1,78 +0,0 @@ - array( - array(array(1), array('node', 'upload')), - ), - 'd6_node_type' => array( - array(array('page'), array('page')), - array(array('story'), array('story')), - ), - ); - $this->prepareMigrations($id_mappings); - - foreach (array('page', 'story') as $type) { - entity_create('node_type', array('type' => $type))->save(); - } - entity_create('field_storage_config', array( - 'entity_type' => 'node', - 'field_name' => 'upload', - 'type' => 'file', - 'translatable' => '0', - ))->save(); - - $this->loadDumps(['NodeType.php', 'Variable.php']); - $this->executeMigration('d6_upload_field_instance'); - } - - /** - * Tests the Drupal 6 upload settings to Drupal 8 field instance migration. - */ - public function testUploadFieldInstance() { - $field = FieldConfig::load('node.page.upload'); - $settings = $field->getSettings(); - $this->assertIdentical('node.page.upload', $field->id()); - $this->assertIdentical('jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp', $settings['file_extensions']); - $this->assertIdentical('1MB', $settings['max_filesize']); - $this->assertIdentical(TRUE, $settings['description_field']); - - $field = FieldConfig::load('node.story.upload'); - $this->assertIdentical('node.story.upload', $field->id()); - - // Shouldn't exist. - $field = FieldConfig::load('node.article.upload'); - $this->assertTrue(is_null($field)); - - $this->assertIdentical(array('node', 'page', 'upload'), entity_load('migration', 'd6_upload_field_instance')->getIdMap()->lookupDestinationID(array('page'))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadTest.php deleted file mode 100644 index 218fec095..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUploadTest.php +++ /dev/null @@ -1,50 +0,0 @@ -executeMigration('d6_upload'); - } - - /** - * Test upload migration from Drupal 6 to Drupal 8. - */ - function testUpload() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); - $node_storage->resetCache(array(1, 2)); - $nodes = Node::loadMultiple(array(1, 2)); - $node = $nodes[1]; - $this->assertIdentical(1, count($node->upload)); - $this->assertIdentical('1', $node->upload[0]->target_id); - $this->assertIdentical('file 1-1-1', $node->upload[0]->description); - $this->assertIdentical(FALSE, $node->upload[0]->isDisplayed()); - - $node = $nodes[2]; - $this->assertIdentical(2, count($node->upload)); - $this->assertIdentical('3', $node->upload[0]->target_id); - $this->assertIdentical('file 2-3-3', $node->upload[0]->description); - $this->assertIdentical(FALSE, $node->upload[0]->isDisplayed()); - $this->assertIdentical('2', $node->upload[1]->target_id); - $this->assertIdentical(TRUE, $node->upload[1]->isDisplayed()); - $this->assertIdentical('file 2-3-2', $node->upload[1]->description); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php deleted file mode 100644 index 956e44485..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php +++ /dev/null @@ -1,65 +0,0 @@ -loadDumps(['Variable.php']); - $this->executeMigration('d6_user_mail'); - $this->executeMigration('d6_user_settings'); - } - - /** - * Tests migration of user variables to user.mail.yml. - */ - public function testUserMail() { - $config = $this->config('user.mail'); - $this->assertIdentical('Account details for !username at !site (approved)', $config->get('status_activated.subject')); - $this->assertIdentical("!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using:\n\nusername: !username\n", $config->get('status_activated.body')); - $this->assertIdentical('Replacement login information for !username at !site', $config->get('password_reset.subject')); - $this->assertIdentical("!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.", $config->get('password_reset.body')); - $this->assertIdentical('Account details for !username at !site (deleted)', $config->get('cancel_confirm.subject')); - $this->assertIdentical("!username,\n\nYour account on !site has been deleted.", $config->get('cancel_confirm.body')); - $this->assertIdentical('An administrator created an account for you at !site', $config->get('register_admin_created.subject')); - $this->assertIdentical("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $config->get('register_admin_created.body')); - $this->assertIdentical('Account details for !username at !site', $config->get('register_no_approval_required.subject')); - $this->assertIdentical("!username,\n\nThank you for registering at !site. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n-- !site team", $config->get('register_no_approval_required.body')); - $this->assertIdentical('Account details for !username at !site (pending admin approval)', $config->get('register_pending_approval.subject')); - $this->assertIdentical("!username,\n\nThank you for registering at !site. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n\n-- !site team", $config->get('register_pending_approval.body')); - $this->assertIdentical('Account details for !username at !site (blocked)', $config->get('status_blocked.subject')); - $this->assertIdentical("!username,\n\nYour account on !site has been blocked.", $config->get('status_blocked.body')); - $this->assertConfigSchema(\Drupal::service('config.typed'), 'user.mail', $config->get()); - } - - /** - * Tests migration of user variables to user.settings.yml. - */ - public function testUserSettings() { - $config = $this->config('user.settings'); - $this->assertIdentical(TRUE, $config->get('notify.status_blocked')); - $this->assertIdentical(FALSE, $config->get('notify.status_activated')); - $this->assertIdentical(FALSE, $config->get('verify_mail')); - $this->assertIdentical('admin_only', $config->get('register')); - $this->assertIdentical('Guest', $config->get('anonymous')); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserContactSettingsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserContactSettingsTest.php deleted file mode 100644 index 355b43e23..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserContactSettingsTest.php +++ /dev/null @@ -1,68 +0,0 @@ -installSchema('user', array('users_data')); - - $this->loadDumps([ - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - $id_mappings = array( - 'd6_user' => array( - array(array(2), array(2)), - array(array(8), array(8)), - array(array(15), array(15)), - ), - ); - $this->prepareMigrations($id_mappings); - - $this->executeMigration('d6_user_contact_settings'); - } - - /** - * Tests the Drupal6 user contact settings migration. - */ - public function testUserContactSettings() { - $user_data = \Drupal::service('user.data'); - $module = $key = 'contact'; - $uid = 2; - $setting = $user_data->get($module, $uid, $key); - $this->assertIdentical('1', $setting); - - $uid = 8; - $setting = $user_data->get($module, $uid, $key); - $this->assertIdentical('0', $setting); - - $uid = 15; - $setting = $user_data->get($module, $uid, $key); - $this->assertIdentical(NULL, $setting); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityDisplayTest.php deleted file mode 100644 index 3a9effb61..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityDisplayTest.php +++ /dev/null @@ -1,51 +0,0 @@ - array( - array(array(1), array('user', 'user', 'user_picture')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->executeMigration('d6_user_picture_entity_display'); - } - - /** - * Tests the Drupal 6 user picture to Drupal 8 entity display migration. - */ - public function testUserPictureEntityDisplay() { - $display = entity_get_display('user', 'user', 'default'); - $component = $display->getComponent('user_picture'); - $this->assertIdentical('image', $component['type']); - $this->assertIdentical('content', $component['settings']['image_link']); - - $this->assertIdentical(array('user', 'user', 'default', 'user_picture'), entity_load('migration', 'd6_user_picture_entity_display')->getIdMap()->lookupDestinationID(array(''))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityFormDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityFormDisplayTest.php deleted file mode 100644 index ebbd0f9f2..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureEntityFormDisplayTest.php +++ /dev/null @@ -1,50 +0,0 @@ - array( - array(array(1), array('user', 'user', 'user_picture')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->executeMigration('d6_user_picture_entity_form_display'); - } - - /** - * Tests the Drupal 6 user picture to Drupal 8 entity form display migration. - */ - public function testUserPictureEntityFormDisplay() { - $display = entity_get_form_display('user', 'user', 'default'); - $component = $display->getComponent('user_picture'); - $this->assertIdentical('image_image', $component['type']); - $this->assertIdentical('throbber', $component['settings']['progress_indicator']); - - $this->assertIdentical(array('user', 'user', 'default', 'user_picture'), entity_load('migration', 'd6_user_picture_entity_form_display')->getIdMap()->lookupDestinationID(array(''))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFieldTest.php deleted file mode 100644 index aebf590c3..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFieldTest.php +++ /dev/null @@ -1,38 +0,0 @@ -executeMigration('d6_user_picture_field'); - } - - /** - * Test the user picture field migration. - */ - public function testUserPictureField() { - $field_storage = FieldStorageConfig::load('user.user_picture'); - $this->assertIdentical('user.user_picture', $field_storage->id()); - $this->assertIdentical(array('user', 'user_picture'), entity_load('migration', 'd6_user_picture_field')->getIdMap()->lookupDestinationID(array(''))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php deleted file mode 100644 index fe176266e..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php +++ /dev/null @@ -1,72 +0,0 @@ -installEntitySchema('file'); - $this->loadDumps([ - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - /** @var \Drupal\migrate\Entity\MigrationInterface $migration */ - $migration = entity_load('migration', 'd6_user_picture_file'); - $source = $migration->get('source'); - $source['site_path'] = 'core/modules/simpletest'; - $migration->set('source', $source); - $this->executeMigration($migration); - } - - /** - * Tests the Drupal 6 user pictures to Drupal 8 migration. - */ - public function testUserPictures() { - $file_ids = array(); - foreach (entity_load('migration', 'd6_user_picture_file')->getIdMap() as $destination_ids) { - $file_ids[] = reset($destination_ids); - } - $files = File::loadMultiple($file_ids); - /** @var \Drupal\file\FileInterface $file */ - $file = array_shift($files); - $this->assertIdentical('image-test.jpg', $file->getFilename()); - $this->assertIdentical('public://image-test.jpg', $file->getFileUri()); - $this->assertIdentical('2', $file->getOwnerId()); - $this->assertIdentical('1901', $file->getSize()); - $this->assertIdentical('image/jpeg', $file->getMimeType()); - - $file = array_shift($files); - $this->assertIdentical('image-test.png', $file->getFilename()); - $this->assertIdentical('public://image-test.png', $file->getFileUri()); - $this->assertIdentical('8', $file->getOwnerId()); - $this->assertFalse($files); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureInstanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureInstanceTest.php deleted file mode 100644 index aac48e1b0..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureInstanceTest.php +++ /dev/null @@ -1,62 +0,0 @@ - array( - array(array('user_upload'), array('name', 'bundle')), - ), - ); - $this->prepareMigrations($id_mappings); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'user_picture', - 'type' => 'image', - 'translatable' => '0', - ))->save(); - - $this->executeMigration('d6_user_picture_field_instance'); - } - - /** - * Tests the Drupal 6 user picture to Drupal 8 picture field instance migration. - */ - public function testUserPictureFieldInstance() { - $field = FieldConfig::load('user.user.user_picture'); - $settings = $field->getSettings(); - $this->assertIdentical('png gif jpg jpeg', $settings['file_extensions']); - $this->assertIdentical('pictures', $settings['file_directory']); - $this->assertIdentical('30KB', $settings['max_filesize']); - $this->assertIdentical('85x85', $settings['max_resolution']); - - $this->assertIdentical(array('user', 'user', 'user_picture'), entity_load('migration', 'd6_user_picture_field_instance')->getIdMap()->lookupDestinationID(array(''))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityDisplayTest.php deleted file mode 100644 index b38f2b7a8..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityDisplayTest.php +++ /dev/null @@ -1,127 +0,0 @@ - 'user', - 'field_name' => 'profile_color', - 'type' => 'text', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_biography', - 'type' => 'text_long', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sell_address', - 'type' => 'boolean', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sold_to', - 'type' => 'list_string', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_bands', - 'type' => 'text', - 'cardinality' => -1, - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_blog', - 'type' => 'link', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_birthdate', - 'type' => 'datetime', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_love_migrations', - 'type' => 'boolean', - ))->save(); - - $this->loadDumps([ - 'ProfileFields.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - $field_data = Database::getConnection('default', 'migrate') - ->select('profile_fields', 'u') - ->fields('u') - ->execute() - ->fetchAll(); - foreach ($field_data as $field) { - entity_create('field_config', array( - 'label' => $field->title, - 'description' => '', - 'field_name' => $field->name, - 'entity_type' => 'user', - 'bundle' => 'user', - 'required' => 1, - ))->save(); - } - - $this->executeMigration('d6_user_profile_entity_display'); - } - - /** - * Tests migration of user profile fields. - */ - public function testUserProfileFields() { - $display = entity_get_display('user', 'user', 'default'); - - // Test a text field. - $component = $display->getComponent('profile_color'); - $this->assertIdentical('text_default', $component['type']); - - // Test a list field. - $component = $display->getComponent('profile_bands'); - $this->assertIdentical('text_default', $component['type']); - - // Test a date field. - $component = $display->getComponent('profile_birthdate'); - $this->assertIdentical('datetime_default', $component['type']); - - // Test PROFILE_PRIVATE field is hidden. - $this->assertNull($display->getComponent('profile_sell_address')); - - // Test PROFILE_HIDDEN field is hidden. - $this->assertNull($display->getComponent('profile_sold_to')); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php deleted file mode 100644 index d0882897f..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileEntityFormDisplayTest.php +++ /dev/null @@ -1,127 +0,0 @@ - 'user', - 'field_name' => 'profile_color', - 'type' => 'text', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_biography', - 'type' => 'text_long', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sell_address', - 'type' => 'boolean', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sold_to', - 'type' => 'list_string', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_bands', - 'type' => 'text', - 'cardinality' => -1, - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_blog', - 'type' => 'link', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_birthdate', - 'type' => 'datetime', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_love_migrations', - 'type' => 'boolean', - ))->save(); - - $this->loadDumps([ - 'ProfileFields.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - $field_data = Database::getConnection('default', 'migrate') - ->select('profile_fields', 'u') - ->fields('u') - ->execute() - ->fetchAll(); - foreach ($field_data as $field) { - entity_create('field_config', array( - 'label' => $field->title, - 'description' => '', - 'field_name' => $field->name, - 'entity_type' => 'user', - 'bundle' => 'user', - 'required' => 1, - ))->save(); - } - - $this->executeMigration('d6_user_profile_entity_form_display'); - } - - /** - * Tests migration of user profile fields. - */ - public function testUserProfileEntityFormDisplay() { - $display = entity_get_form_display('user', 'user', 'default'); - - // Test a text field. - $component = $display->getComponent('profile_color'); - $this->assertIdentical('text_textfield', $component['type']); - - // Test a list field. - $component = $display->getComponent('profile_bands'); - $this->assertIdentical('text_textfield', $component['type']); - - // Test a date field. - $component = $display->getComponent('profile_birthdate'); - $this->assertIdentical('datetime_default', $component['type']); - - // Test PROFILE_PRIVATE field is hidden. - $this->assertNull($display->getComponent('profile_sell_address')); - - // Test PROFILE_HIDDEN field is hidden. - $this->assertNull($display->getComponent('profile_sold_to')); - - // Test that a checkbox field has the proper display label setting. - $component = $display->getComponent('profile_love_migrations'); - $this->assertIdentical('boolean_checkbox', $component['type']); - $this->assertIdentical(true, $component['settings']['display_label']); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldInstanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldInstanceTest.php deleted file mode 100644 index cb834d776..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldInstanceTest.php +++ /dev/null @@ -1,114 +0,0 @@ - array( - array(array(1), array('user', 'profile_color')), - ), - ); - $this->prepareMigrations($id_mappings); - $this->createFields(); - $this->loadDumps(array( - 'ProfileFields.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - )); - $this->executeMigration('d6_user_profile_field_instance'); - } - - /** - * Tests migration of user profile fields. - */ - public function testUserProfileFields() { - // Migrated a text field. - $field = FieldConfig::load('user.user.profile_color'); - $this->assertIdentical('Favorite color', $field->label()); - $this->assertIdentical('List your favorite color', $field->getDescription()); - - // Migrated a textarea. - $field = FieldConfig::load('user.user.profile_biography'); - $this->assertIdentical('Biography', $field->label()); - $this->assertIdentical('Tell people a little bit about yourself', $field->getDescription()); - - // Migrated checkbox field. - $field = FieldConfig::load('user.user.profile_sell_address'); - $this->assertIdentical('Sell your email address?', $field->label()); - $this->assertIdentical("If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!", $field->getDescription()); - - // Migrated selection field. - $field = FieldConfig::load('user.user.profile_sold_to'); - $this->assertIdentical('Sales Category', $field->label()); - $this->assertIdentical("Select the sales categories to which this user's address was sold.", $field->getDescription()); - - // Migrated list field. - $field = FieldConfig::load('user.user.profile_bands'); - $this->assertIdentical('Favorite bands', $field->label()); - $this->assertIdentical("Enter your favorite bands. When you've saved your profile, you'll be able to find other people with the same favorites.", $field->getDescription()); - -/* - // Migrated URL field. - $field = FieldConfig::load('user.user.profile_blog'); - $this->assertIdentical('Your blog', $field->label()); - $this->assertIdentical("Paste the full URL, $field->getDescription(), including http://, of your personal blog."); -*/ - - // Migrated date field. - $field = FieldConfig::load('user.user.profile_birthdate'); - $this->assertIdentical('Birthdate', $field->label()); - $this->assertIdentical("Enter your birth date and we'll send you a coupon.", $field->getDescription()); - - // Another migrated checkbox field, with a different source visibility setting. - $field = FieldConfig::load('user.user.profile_love_migrations'); - $this->assertIdentical('I love migrations', $field->label()); - $this->assertIdentical("If you check this box, you love migrations.", $field->getDescription()); - } - - /** - * Helper to create fields. - */ - protected function createFields() { - $fields = array( - 'profile_color' => 'text', - 'profile_biography' => 'text_long', - 'profile_sell_address' => 'boolean', - 'profile_sold_to' => 'list_string', - 'profile_bands' => 'text', - 'profile_blog' => 'link', - 'profile_birthdate' => 'datetime', - 'profile_love_migrations' => 'boolean', - ); - foreach ($fields as $name => $type) { - entity_create('field_storage_config', array( - 'field_name' => $name, - 'entity_type' => 'user', - 'type' => $type, - ))->save(); - } - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php deleted file mode 100644 index b331a59d8..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php +++ /dev/null @@ -1,85 +0,0 @@ -loadDumps([ - 'ProfileFields.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - $this->executeMigration('d6_user_profile_field'); - } - - /** - * Tests migration of user profile fields. - */ - public function testUserProfileFields() { - // Migrated a text field. - $field_storage = FieldStorageConfig::load('user.profile_color'); - $this->assertIdentical('text', $field_storage->getType(), 'Field type is text.'); - $this->assertIdentical(1, $field_storage->getCardinality(), 'Text field has correct cardinality'); - - // Migrated a textarea. - $field_storage = FieldStorageConfig::load('user.profile_biography'); - $this->assertIdentical('text_long', $field_storage->getType(), 'Field type is text_long.'); - - // Migrated checkbox field. - $field_storage = FieldStorageConfig::load('user.profile_sell_address'); - $this->assertIdentical('boolean', $field_storage->getType(), 'Field type is boolean.'); - - // Migrated selection field. - $field_storage = FieldStorageConfig::load('user.profile_sold_to'); - $this->assertIdentical('list_string', $field_storage->getType(), 'Field type is list_string.'); - $settings = $field_storage->getSettings(); - $this->assertEqual($settings['allowed_values'], array( - 'Pill spammers' => 'Pill spammers', - 'Fitness spammers' => 'Fitness spammers', - 'Back\slash' => 'Back\slash', - 'Forward/slash' => 'Forward/slash', - 'Dot.in.the.middle' => 'Dot.in.the.middle', - 'Faithful servant' => 'Faithful servant', - 'Anonymous donor' => 'Anonymous donor', - )); - $this->assertIdentical('list_string', $field_storage->getType(), 'Field type is list_string.'); - - // Migrated list field. - $field_storage = FieldStorageConfig::load('user.profile_bands'); - $this->assertIdentical('text', $field_storage->getType(), 'Field type is text.'); - $this->assertIdentical(-1, $field_storage->getCardinality(), 'List field has correct cardinality'); - -/* - // Migrated URL field. - $field_storage = FieldStorageConfig::load('user.profile_blog'); - $this->assertIdentical('link', $field_storage->getType(), 'Field type is link.'); -*/ - - // Migrated date field. - $field_storage = FieldStorageConfig::load('user.profile_birthdate'); - $this->assertIdentical('datetime', $field_storage->getType(), 'Field type is datetime.'); - $this->assertIdentical('date', $field_storage->getSettings()['datetime_type']); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileValuesTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileValuesTest.php deleted file mode 100644 index fa4489e5a..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileValuesTest.php +++ /dev/null @@ -1,174 +0,0 @@ - 'user', - 'field_name' => 'profile_color', - 'type' => 'text', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_biography', - 'type' => 'text_long', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sell_address', - 'type' => 'boolean', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_sold_to', - 'type' => 'list_string', - 'settings' => array( - 'allowed_values' => array( - 'Pill spammers' => 'Pill spammers', - 'Fitness spammers' => 'Fitness spammers', - ) - ) - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_bands', - 'type' => 'text', - 'cardinality' => -1, - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_blog', - 'type' => 'link', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_birthdate', - 'type' => 'datetime', - ))->save(); - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'profile_love_migrations', - 'type' => 'boolean', - ))->save(); - - // Add some id mappings for the dependant migrations. - $id_mappings = array( - 'd6_user_profile_field_instance' => array( - array(array(1), array('user', 'user', 'fieldname')), - ), - 'd6_user_profile_entity_display' => array( - array(array(1), array('user', 'user', 'default', 'fieldname')), - ), - 'd6_user_profile_entity_form_display' => array( - array(array(1), array('user', 'user', 'default', 'fieldname')), - ), - 'd6_user' => array( - array(array(2), array(2)), - array(array(8), array(8)), - array(array(15), array(15)), - ), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps([ - 'ProfileFields.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - $field_data = Database::getConnection('default', 'migrate') - ->select('profile_fields', 'u') - ->fields('u') - ->execute() - ->fetchAll(); - // Create the field instances. - foreach ($field_data as $field) { - entity_create('field_config', array( - 'label' => $field->title, - 'description' => '', - 'field_name' => $field->name, - 'entity_type' => 'user', - 'bundle' => 'user', - 'required' => 0, - ))->save(); - } - - // Create our users for the node authors. - $query = Database::getConnection('default', 'migrate')->query('SELECT * FROM {users} WHERE uid NOT IN (0, 1)'); - while(($row = $query->fetchAssoc()) !== FALSE) { - $user = entity_create('user', $row); - $user->enforceIsNew(); - $user->save(); - } - - $migration_format = entity_load('migration', 'd6_profile_values:user'); - $this->executeMigration($migration_format); - } - - /** - * Tests Drupal 6 profile values to Drupal 8 migration. - */ - public function testUserProfileValues() { - $user = User::load(2); - $this->assertFalse(is_null($user)); - $this->assertIdentical('red', $user->profile_color->value); - $expected = <<assertIdentical($expected, $user->profile_biography->value); - $this->assertIdentical('1', $user->profile_sell_address->value); - $this->assertIdentical('Back\slash', $user->profile_sold_to->value); - $this->assertIdentical('AC/DC', $user->profile_bands[0]->value); - $this->assertIdentical('Eagles', $user->profile_bands[1]->value); - $this->assertIdentical('Elton John', $user->profile_bands[2]->value); - $this->assertIdentical('Lemonheads', $user->profile_bands[3]->value); - $this->assertIdentical('Rolling Stones', $user->profile_bands[4]->value); - $this->assertIdentical('Queen', $user->profile_bands[5]->value); - $this->assertIdentical('The White Stripes', $user->profile_bands[6]->value); - $this->assertIdentical('1974-06-02', $user->profile_birthdate->value); - - $user = User::load(8); - $this->assertIdentical('Forward/slash', $user->profile_sold_to->value); - - $user = User::load(15); - $this->assertIdentical('Dot.in.the.middle', $user->profile_sold_to->value); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php deleted file mode 100644 index ebd2b6b38..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserRoleTest.php +++ /dev/null @@ -1,98 +0,0 @@ - array( - array(array(1), array('filtered_html')), - array(array(2), array('full_html')) - ), - ); - $this->prepareMigrations($id_mappings); - - $this->loadDumps([ - 'Permission.php', - 'Role.php', - 'Filters.php', - 'FilterFormats.php', - 'Variable.php', - ]); - $this->executeMigration('d6_user_role'); - } - - /** - * Tests user role migration. - */ - public function testUserRole() { - /** @var \Drupal\migrate\entity\Migration $migration */ - $migration = entity_load('migration', 'd6_user_role'); - $rid = 'anonymous'; - $anonymous = Role::load($rid); - $this->assertIdentical($rid, $anonymous->id()); - $this->assertIdentical(array('migrate test anonymous permission', 'use text format filtered_html'), $anonymous->getPermissions()); - $this->assertIdentical(array($rid), $migration->getIdMap()->lookupDestinationId(array(1))); - $rid = 'authenticated'; - $authenticated = Role::load($rid); - $this->assertIdentical($rid, $authenticated->id()); - $this->assertIdentical(array('migrate test authenticated permission', 'use text format filtered_html'), $authenticated->getPermissions()); - $this->assertIdentical(array($rid), $migration->getIdMap()->lookupDestinationId(array(2))); - $rid = 'migrate_test_role_1'; - $migrate_test_role_1 = Role::load($rid); - $this->assertIdentical($rid, $migrate_test_role_1->id()); - $this->assertIdentical(array(0 => 'migrate test role 1 test permission', 'use text format full_html'), $migrate_test_role_1->getPermissions()); - $this->assertIdentical(array($rid), $migration->getIdMap()->lookupDestinationId(array(3))); - $rid = 'migrate_test_role_2'; - $migrate_test_role_2 = Role::load($rid); - $this->assertIdentical(array( - 'migrate test role 2 test permission', - 'use PHP for settings', - 'administer contact forms', - 'skip comment approval', - 'edit own blog content', - 'edit any blog content', - 'delete own blog content', - 'delete any blog content', - 'create forum content', - 'delete any forum content', - 'delete own forum content', - 'edit any forum content', - 'edit own forum content', - 'administer nodes', - 'access content overview', - ), $migrate_test_role_2->getPermissions()); - $this->assertIdentical($rid, $migrate_test_role_2->id()); - $this->assertIdentical(array($rid), $migration->getIdMap()->lookupDestinationId(array(4))); - $rid = 'migrate_test_role_3_that_is_long'; - $migrate_test_role_3 = Role::load($rid); - $this->assertIdentical($rid, $migrate_test_role_3->id()); - $this->assertIdentical(array($rid), $migration->getIdMap()->lookupDestinationId(array(5))); - } - -} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php deleted file mode 100644 index d584c3ad8..000000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php +++ /dev/null @@ -1,184 +0,0 @@ -installEntitySchema('file'); - $this->installSchema('file', ['file_usage']); - - // Create the user profile field and instance. - entity_create('field_storage_config', array( - 'entity_type' => 'user', - 'field_name' => 'user_picture', - 'type' => 'image', - 'translatable' => '0', - ))->save(); - entity_create('field_config', array( - 'label' => 'User Picture', - 'description' => '', - 'field_name' => 'user_picture', - 'entity_type' => 'user', - 'bundle' => 'user', - 'required' => 0, - ))->save(); - - $file = entity_create('file', array( - 'fid' => 2, - 'uid' => 2, - 'filename' => 'image-test.jpg', - 'uri' => "public://image-test.jpg", - 'filemime' => 'image/jpeg', - 'created' => 1, - 'changed' => 1, - 'status' => FILE_STATUS_PERMANENT, - )); - $file->enforceIsNew(); - file_put_contents($file->getFileUri(), file_get_contents('core/modules/simpletest/files/image-1.png')); - $file->save(); - - $file = entity_create('file', array( - 'fid' => 8, - 'uid' => 8, - 'filename' => 'image-test.png', - 'uri' => "public://image-test.png", - 'filemime' => 'image/png', - 'created' => 1, - 'changed' => 1, - 'status' => FILE_STATUS_PERMANENT, - )); - $file->enforceIsNew(); - file_put_contents($file->getFileUri(), file_get_contents('core/modules/simpletest/files/image-2.jpg')); - $file->save(); - - $this->loadDumps([ - 'Filters.php', - 'FilterFormats.php', - 'Variable.php', - 'ProfileFields.php', - 'Permission.php', - 'Role.php', - 'Users.php', - 'ProfileValues.php', - 'UsersRoles.php', - 'EventTimezones.php', - ]); - - $id_mappings = array( - 'd6_user_role' => array( - array(array(1), array('anonymous user')), - array(array(2), array('authenticated user')), - array(array(3), array('migrate test role 1')), - array(array(4), array('migrate test role 2')), - array(array(5), array('migrate test role 3')), - ), - 'd6_user_picture_entity_display' => array( - array(array(1), array('user', 'user', 'default', 'user_picture')), - ), - 'd6_user_picture_entity_form_display' => array( - array(array(1), array('user', 'user', 'default', 'user_picture')), - ), - 'd6_user_picture_file' => array( - array(array(2), array(2)), - array(array(8), array(8)), - ), - ); - - $this->prepareMigrations($id_mappings); - - $this->executeMigration('d6_user'); - } - - /** - * Tests the Drupal6 user to Drupal 8 migration. - */ - public function testUser() { - $users = Database::getConnection('default', 'migrate') - ->select('users', 'u') - ->fields('u') - ->execute() - ->fetchAll(); - - foreach ($users as $source) { - // Get roles directly from the source. - $rids = Database::getConnection('default', 'migrate') - ->select('users_roles', 'ur') - ->fields('ur', array('rid')) - ->condition('ur.uid', $source->uid) - ->execute() - ->fetchCol(); - $roles = array(RoleInterface::AUTHENTICATED_ID); - $migration_role = entity_load('migration', 'd6_user_role'); - foreach ($rids as $rid) { - $role = $migration_role->getIdMap()->lookupDestinationId(array($rid)); - $roles[] = reset($role); - } - - /** @var \Drupal\user\UserInterface $user */ - $user = User::load($source->uid); - $this->assertIdentical($source->uid, $user->id()); - $this->assertIdentical($source->name, $user->label()); - $this->assertIdentical($source->mail, $user->getEmail()); - $this->assertIdentical($source->created, $user->getCreatedTime()); - $this->assertIdentical($source->access, $user->getLastAccessedTime()); - $this->assertIdentical($source->login, $user->getLastLoginTime()); - $is_blocked = $source->status == 0; - $this->assertIdentical($is_blocked, $user->isBlocked()); - // $user->getPreferredLangcode() might fallback to default language if the - // user preferred language is not configured on the site. We just want to - // test if the value was imported correctly. - $this->assertIdentical($source->language, $user->preferred_langcode->value); - $time_zone = $source->expected_timezone ?: $this->config('system.date')->get('timezone.default'); - $this->assertIdentical($time_zone, $user->getTimeZone()); - $this->assertIdentical($source->init, $user->getInitialEmail()); - $this->assertIdentical($roles, $user->getRoles()); - - // We have one empty picture in the data so don't try load that. - if (!empty($source->picture)) { - // Test the user picture. - $file = File::load($user->user_picture->target_id); - $this->assertIdentical(basename($source->picture), $file->getFilename()); - } - - // Use the API to check if the password has been salted and re-hashed to - // conform the Drupal >= 7. - $this->assertTrue(\Drupal::service('password')->check($source->pass_plain, $user->getPassword())); - } - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/MigrationStorageTest.php b/core/modules/migrate_drupal/tests/src/Unit/MigrationStorageTest.php deleted file mode 100644 index 4c2650930..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/MigrationStorageTest.php +++ /dev/null @@ -1,78 +0,0 @@ - 'test_migration', 'migrationClass' => 'Drupal\migrate_drupal\Entity\Migration'); - - /** - * Test that the entity load hooks are called on dynamic migrations. - * - * @dataProvider entityIdsDataProvider - */ - public function testMigrationStorage($entity_ids) { - $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface'); - $entity_type - ->expects($this->exactly(2)) - ->method('isStaticallyCacheable') - ->willReturn(FALSE); - - $load_plugin = $this->getMock('Drupal\migrate_drupal\Plugin\MigrateLoadInterface'); - $load_plugin - ->expects($this->once()) - ->method('loadMultiple') - ->willReturn([]); - - $migration = $this->getMigration(); - $migration - ->expects($this->once()) - ->method('getLoadPlugin') - ->willReturn($load_plugin); - - $storage = $this->getMock('Drupal\migrate_drupal\TestMigrationStorage', ['postLoad', 'doLoadMultiple'], [$entity_type]); - $storage - ->expects($this->exactly(2)) - ->method('postLoad'); - $storage - ->expects($this->once()) - ->method('doLoadMultiple') - ->willReturn(['test_migration' => $migration]); - - $storage->loadMultiple($entity_ids); - } - - /** - * The data provider for migration storage. - * - * @return array - * The entity ids. - */ - public function entityIdsDataProvider() { - return [ - [['test_migration:bundle']], - [NULL], - ]; - } - -} - -namespace Drupal\migrate_drupal; - -class TestMigrationStorage extends MigrationStorage { - public function __construct($entity_type) { - $this->entityType = $entity_type; - } -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentSourceWithHighWaterTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentSourceWithHighWaterTest.php deleted file mode 100644 index 26a7e51e9..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentSourceWithHighWaterTest.php +++ /dev/null @@ -1,28 +0,0 @@ -migrationConfiguration['highWaterProperty']['field'] = 'timestamp'; - array_shift($this->expectedResults); - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentTest.php deleted file mode 100644 index 660ae4acf..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/CommentTest.php +++ /dev/null @@ -1,17 +0,0 @@ - 'test', - // Leave it empty for now. - 'idlist' => array(), - // This needs to be the identifier of the actual key: cid for comment, nid - // for node and so on. - 'source' => array( - 'plugin' => 'd6_comment', - ), - ); - - // We need to set up the database contents; it's easier to do that below. - - protected $expectedResults = array( - array( - 'cid' => 1, - 'pid' => 0, - 'nid' => 2, - 'uid' => 3, - 'subject' => 'subject value 1', - 'comment' => 'comment value 1', - 'hostname' => 'hostname value 1', - 'timestamp' => 1382255613, - 'status' => 1, - 'thread' => '', - 'name' => '', - 'mail' => '', - 'homepage' => '', - 'format' => 'testformat1', - 'type' => 'story', - ), - array( - 'cid' => 2, - 'pid' => 1, - 'nid' => 3, - 'uid' => 4, - 'subject' => 'subject value 2', - 'comment' => 'comment value 2', - 'hostname' => 'hostname value 2', - 'timestamp' => 1382255662, - 'status' => 1, - 'thread' => '', - 'name' => '', - 'mail' => '', - 'homepage' => '', - 'format' => 'testformat2', - 'type' => 'page', - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - foreach ($this->expectedResults as $k => $row) { - $this->databaseContents['comments'][$k] = $row; - $this->databaseContents['comments'][$k]['status'] = 1 - $this->databaseContents['comments'][$k]['status']; - } - // Add node table data. - $this->databaseContents['node'][] = array('nid' => 2, 'type' => 'story'); - $this->databaseContents['node'][] = array('nid' => 3, 'type' => 'page'); - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstancePerViewModeTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstancePerViewModeTest.php deleted file mode 100644 index 0bf81f927..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstancePerViewModeTest.php +++ /dev/null @@ -1,108 +0,0 @@ - 'view_mode_test', - // Leave it empty for now. - 'idlist' => array(), - 'source' => array( - 'plugin' => 'd6_field_instance_per_view_mode', - ), - ); - - protected $expectedResults = array( - array( - 'entity_type' => 'node', - 'view_mode' => 4, - 'type_name' => 'article', - 'field_name' => 'field_test', - 'type' => 'text', - 'module' => 'text', - 'weight' => 1, - 'label' => 'above', - 'display_settings' => array( - 'weight' => 1, - 'parent' => '', - 'label' => array( - 'format' => 'above', - ), - 4 => array( - 'format' => 'trimmed', - 'exclude' => 0, - ), - ), - 'widget_settings' => array(), - ), - array( - 'entity_type' => 'node', - 'view_mode' => 'teaser', - 'type_name' => 'story', - 'field_name' => 'field_test', - 'type' => 'text', - 'module' => 'text', - 'weight' => 2, - 'label' => 'above', - 'display_settings' => array( - 'weight' => 1, - 'parent' => '', - 'label' => array( - 'format' => 'above', - ), - 'teaser' => array( - 'format' => 'trimmed', - 'exclude' => 0, - ), - ), - 'widget_settings' => array(), - ), - ); - - - /** - * {@inheritdoc} - */ - protected function setUp() { - foreach ($this->expectedResults as $k => $field_view_mode) { - // These are stored as serialized strings. - $field_view_mode['display_settings'] = serialize($field_view_mode['display_settings']); - $field_view_mode['widget_settings'] = serialize($field_view_mode['widget_settings']); - - $this->databaseContents['content_node_field'][] = array( - 'field_name' => $field_view_mode['field_name'], - 'type' => $field_view_mode['type'], - 'module' => $field_view_mode['module'], - ); - unset($field_view_mode['type']); - unset($field_view_mode['module']); - - $this->databaseContents['content_node_field_instance'][] = $field_view_mode; - - // Update the expected display settings. - $this->expectedResults[$k]['display_settings'] = $this->expectedResults[$k]['display_settings'][$field_view_mode['view_mode']]; - - } - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstanceTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstanceTest.php deleted file mode 100644 index 22300bfe5..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldInstanceTest.php +++ /dev/null @@ -1,98 +0,0 @@ - 'test_fieldinstance', - // Leave it empty for now. - 'idlist' => [], - 'source' => [ - 'plugin' => 'd6_field_instance', - ], - ]; - - // We need to set up the database contents; it's easier to do that below. - // These are sample result queries. - protected $expectedResults = [ - [ - 'field_name' => 'field_body', - 'type_name' => 'page', - 'weight' => 1, - 'label' => 'body', - 'widget_type' => 'text_textarea', - 'widget_settings' => '', - 'display_settings' => '', - 'description' => '', - 'widget_module' => 'text', - 'widget_active' => 1, - 'required' => 1, - 'active' => 1, - 'global_settings' => [], - ], - ]; - - /** - * Prepopulate contents with results. - */ - protected function setUp() { - $this->expectedResults[0]['widget_settings'] = [ - 'rows' => 5, - 'size' => 60, - 'default_value' => [ - [ - 'value' => '', - '_error_element' => 'default_value_widget][field_body][0][value', - 'default_value_php' => '', - ], - ], - ]; - $this->expectedResults[0]['display_settings'] = [ - 'label' => [ - 'format' => 'above', - 'exclude' => 0, - ], - 'teaser' => [ - 'format' => 'default', - 'exclude' => 0, - ], - 'full' => [ - 'format' => 'default', - 'exclude' => 0, - ], - ]; - $this->databaseContents['content_node_field_instance'] = $this->expectedResults; - $this->databaseContents['content_node_field_instance'][0]['widget_settings'] = serialize($this->expectedResults[0]['widget_settings']); - $this->databaseContents['content_node_field_instance'][0]['display_settings'] = serialize($this->expectedResults[0]['display_settings']); - $this->databaseContents['content_node_field_instance'][0]['global_settings'] = 'a:0:{}'; - - $this->databaseContents['content_node_field'][0] = [ - 'field_name' => 'field_body', - 'required' => 1, - 'type' => 'text', - 'active' => 1, - 'global_settings' => serialize([]), - ]; - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldTest.php deleted file mode 100644 index e95ac4a0d..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FieldTest.php +++ /dev/null @@ -1,80 +0,0 @@ - 'test_field', - // Leave it empty for now. - 'idlist' => array(), - 'source' => array( - 'plugin' => 'd6_field', - ), - ); - - // We need to set up the database contents; it's easier to do that below. - // These are sample result queries. - protected $expectedResults = array( - array( - 'field_name' => 'field_body', - 'type' => 'text', - 'global_settings' => '', - 'required' => 0, - 'multiple' => 0, - 'db_storage' => 1, - 'module' => 'text', - 'db_columns' => '', - 'active' => 1, - 'locked' => 0, - ), - ); - - /** - * Prepopulate contents with results. - */ - protected function setUp() { - $this->expectedResults[0]['global_settings'] = array( - 'text_processing' => 0, - 'max_length' => '', - 'allowed_values' => '', - 'allowed_values_php' => '', - ); - $this->expectedResults[0]['db_columns'] = array( - 'value' => array( - 'type' => 'text', - 'size' => 'big', - 'not null' => '', - 'sortable' => 1, - 'views' => 1, - ), - ); - $this->databaseContents['content_node_field'] = $this->expectedResults; - $this->databaseContents['content_node_field'][0]['global_settings'] = serialize($this->databaseContents['content_node_field'][0]['global_settings']); - $this->databaseContents['content_node_field'][0]['db_columns'] = serialize($this->databaseContents['content_node_field'][0]['db_columns']); - - $this->databaseContents['content_node_field_instance'][0]['widget_settings'] = serialize(array()); - $this->databaseContents['content_node_field_instance'][0]['widget_type'] = 'text_textarea'; - $this->databaseContents['content_node_field_instance'][0]['field_name'] = 'field_body'; - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FileTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/FileTest.php deleted file mode 100644 index 52614c900..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/FileTest.php +++ /dev/null @@ -1,63 +0,0 @@ - 'test', - // Leave it empty for now. - 'idlist' => array(), - 'source' => array( - 'plugin' => 'd6_file', - ), - ); - - protected $expectedResults = array( - array( - 'fid' => 1, - 'uid' => 1, - 'filename' => 'migrate-test-file-1.pdf', - 'filepath' => 'sites/default/files/migrate-test-file-1.pdf', - 'filemime' => 'application/pdf', - 'filesize' => 890404, - 'status' => 1, - 'timestamp' => 1382255613, - ), - array( - 'fid' => 2, - 'uid' => 1, - 'filename' => 'migrate-test-file-2.pdf', - 'filepath' => 'sites/default/files/migrate-test-file-2.pdf', - 'filemime' => 'application/pdf', - 'filesize' => 204124, - 'status' => 1, - 'timestamp' => 1382255662, - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['files'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/ProfileFieldTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/ProfileFieldTest.php deleted file mode 100644 index 4a8609eea..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/ProfileFieldTest.php +++ /dev/null @@ -1,96 +0,0 @@ - 'test_profile_fields', - // Leave it empty for now. - 'idlist' => [], - 'source' => [ - 'plugin' => 'd6_profile_field', - ], - ]; - - // We need to set up the database contents; it's easier to do that below. - // These are sample result queries. - // @todo Add multiple cases. - protected $expectedResults = [ - [ - 'fid' => 1, - 'title' => 'First name', - 'name' => 'profile_first_name', - 'explanation' => 'First name user', - 'category' => 'profile', - 'page' => '', - 'type' => 'textfield', - 'weight' => 0, - 'required' => 1, - 'register' => 0, - 'visibility' => 2, - 'autocomplete' => 0, - 'options' => [], - ], - [ - 'fid' => 2, - 'title' => 'Last name', - 'name' => 'profile_last_name', - 'explanation' => 'Last name user', - 'category' => 'profile', - 'page' => '', - 'type' => 'textfield', - 'weight' => 0, - 'required' => 0, - 'register' => 0, - 'visibility' => 2, - 'autocomplete' => 0, - 'options' => [], - ], - [ - 'fid' => 3, - 'title' => 'Policy', - 'name' => 'profile_policy', - 'explanation' => 'A checkbox that say if you accept policy of website', - 'category' => 'profile', - 'page' => '', - 'type' => 'checkbox', - 'weight' => 0, - 'required' => 1, - 'register' => 1, - 'visibility' => 2, - 'autocomplete' => 0, - 'options' => [], - ], - ]; - - /** - * Prepopulate contents with results. - */ - protected function setUp() { - $this->databaseContents['profile_fields'] = $this->expectedResults; - foreach ($this->databaseContents['profile_fields'] as &$row) { - $row['options'] = serialize([]); - } - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php deleted file mode 100644 index e9311d7fe..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/RoleTest.php +++ /dev/null @@ -1,88 +0,0 @@ - 'test', - // Leave it empty for now. - 'idlist' => array(), - // This needs to be the identifier of the actual key: cid for comment, nid - // for node and so on. - 'source' => array( - 'plugin' => 'd6_user_role', - ), - ); - - protected $expectedResults = array( - array( - 'rid' => 1, - 'name' => 'anonymous user', - 'permissions' => array( - 'access content', - ), - ), - array( - 'rid' => 2, - 'name' => 'authenticated user', - 'permissions' => array( - 'access comments', - 'access content', - 'post comments', - 'post comments without approval', - ), - ), - array( - 'rid' => 3, - 'name' => 'administrator', - 'permissions' => array( - 'access comments', - 'administer comments', - 'post comments', - 'post comments without approval', - 'access content', - 'administer content types', - 'administer nodes', - ), - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - foreach ($this->expectedResults as $row) { - $this->databaseContents['permission'][] = array( - 'perm' => implode(', ', $row['permissions']), - 'rid' => $row['rid'], - ); - unset($row['permissions']); - $this->databaseContents['role'][] = $row; - } - $this->databaseContents['filter_formats'][] = array( - 'format' => 1, - 'roles' => '', - ); - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestComment.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestComment.php deleted file mode 100644 index 158780a98..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestComment.php +++ /dev/null @@ -1,21 +0,0 @@ -database = $database; - } - public function setModuleHandler(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNode.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNode.php deleted file mode 100644 index 471416e6c..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNode.php +++ /dev/null @@ -1,37 +0,0 @@ -database = $database; - } - - /** - * Sets the module handler for this source plugin. - * - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - */ - public function setModuleHandler(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNodeRevision.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNodeRevision.php deleted file mode 100644 index 77e5ac6d4..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestNodeRevision.php +++ /dev/null @@ -1,37 +0,0 @@ -database = $database; - } - - /** - * Sets the module handler for this source plugin. - * - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - */ - public function setModuleHandler(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestTerm.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestTerm.php deleted file mode 100644 index 6cf73e4d0..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/TestTerm.php +++ /dev/null @@ -1,21 +0,0 @@ -database = $database; - } - public function setModuleHandler(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserPictureTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserPictureTest.php deleted file mode 100644 index de703854c..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserPictureTest.php +++ /dev/null @@ -1,50 +0,0 @@ - 'test_user_picture', - 'idlist' => array(), - 'source' => array( - 'plugin' => 'd6_user_picture', - ), - ); - - protected $expectedResults = array( - array( - 'uid' => 1, - 'access' => 1382835435, - 'picture' => 'sites/default/files/pictures/picture-1.jpg', - ), - array( - 'uid' => 2, - 'access' => 1382835436, - 'picture' => 'sites/default/files/pictures/picture-2.jpg', - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['users'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserTest.php deleted file mode 100644 index 36d4b6730..000000000 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/UserTest.php +++ /dev/null @@ -1,89 +0,0 @@ - 'test', - 'idlist' => array(), - 'source' => array( - 'plugin' => 'd6_user', - ), - ); - - protected $expectedResults = array( - array( - 'uid' => 2, - 'name' => 'admin', - // @todo d6 hash? - 'pass' => '1234', - 'mail' => 'admin@example.com', - 'theme' => '', - 'signature' => '', - 'signature_format' => 0, - 'created' => 1279402616, - 'access' => 1322981278, - 'login' => 1322699994, - 'status' => 0, - 'timezone' => 'America/Lima', - 'language' => 'en', - // @todo Add the file when needed. - 'picture' => 'sites/default/files/pictures/picture-1.jpg', - 'init' => 'admin@example.com', - 'data' => NULL, - ), - array( - 'uid' => 4, - 'name' => 'alice', - // @todo d6 hash? - 'pass' => '1234', - 'mail' => 'alice@example.com', - 'theme' => '', - 'signature' => '', - 'signature_format' => 0, - 'created' => 1322981368, - 'access' => 1322982419, - 'login' => 132298140, - 'status' => 0, - 'timezone' => 'America/Lima', - 'language' => 'en', - 'picture' => '', - 'init' => 'alice@example.com', - 'data' => NULL, - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - foreach ($this->expectedResults as $k => $row) { - $this->databaseContents['users'][$k] = $row; - } - // getDatabase() will not create empty tables, so we need to insert data - // even if it's irrelevant to the test. - $this->databaseContents['users_roles'] = array( - array( - 'uid' => 99, - 'rid' => 99, - ), - ); - parent::setUp(); - } - -} diff --git a/core/modules/search/src/Tests/Migrate/d6/MigrateSearchConfigsTest.php b/core/modules/search/src/Tests/Migrate/d6/MigrateSearchConfigsTest.php deleted file mode 100644 index 4cb4298d6..000000000 --- a/core/modules/search/src/Tests/Migrate/d6/MigrateSearchConfigsTest.php +++ /dev/null @@ -1,50 +0,0 @@ -loadDumps(['Variable.php']); - $this->executeMigration('d6_search_settings'); - } - - /** - * Tests migration of search variables to search.settings.yml. - */ - public function testSearchSettings() { - $config = $this->config('search.settings'); - $this->assertIdentical(3, $config->get('index.minimum_word_size')); - $this->assertIdentical(TRUE, $config->get('index.overlap_cjk')); - $this->assertIdentical(100, $config->get('index.cron_limit')); - $this->assertIdentical(TRUE, $config->get('logging')); - $this->assertConfigSchema(\Drupal::service('config.typed'), 'search.settings', $config->get()); - } - -} diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css deleted file mode 100644 index b38c5e5bf..000000000 --- a/core/modules/system/css/system.module.css +++ /dev/null @@ -1,448 +0,0 @@ -/** - * @file - * Generic theme-independent base styles. - */ - -/** - * Autocomplete. - * - * @see autocomplete.js - */ - -/* Animated throbber */ -.js input.form-autocomplete { - background-image: url(../../../misc/throbber-inactive.png); - background-position: 100% center; /* LTR */ - background-repeat: no-repeat; -} -.js[dir="rtl"] input.form-autocomplete { - background-position: 0% center; -} -.js input.form-autocomplete.ui-autocomplete-loading { - background-image: url(../../../misc/throbber-active.gif); - background-position: 100% center; /* LTR */ -} -.js[dir="rtl"] input.form-autocomplete.ui-autocomplete-loading { - background-position: 0% center; -} - -/** - * Unboxed fieldsets for grouping form elements. - */ -.fieldgroup { - border-width: 0; - padding: 0; -} - -/** - * Collapsible details. - * - * @see collapse.js - */ -.js details:not([open]) .details-wrapper { - display: none; -} - -/** - * Resizable textareas. - */ -.form-textarea-wrapper textarea { - display: block; - margin: 0; - width: 100%; - box-sizing: border-box; -} -.resize-none { - resize: none; -} -.resize-vertical { - resize: vertical; - min-height: 2em; -} -.resize-horizontal { - resize: horizontal; - max-width: 100%; -} -.resize-both { - resize: both; - max-width: 100%; - min-height: 2em; -} - -/** - * TableDrag behavior. - * - * @see tabledrag.js - */ -body.drag { - cursor: move; -} -tr.region-title { - font-weight: bold; -} -tr.region-message { - color: #999; -} -tr.region-populated { - display: none; -} -tr.add-new .tabledrag-changed { - display: none; -} -.draggable a.tabledrag-handle { - cursor: move; - float: left; /* LTR */ - height: 1.7em; - margin-left: -1em; /* LTR */ - overflow: hidden; - text-decoration: none; -} -[dir="rtl"] .draggable a.tabledrag-handle { - float: right; - margin-right: -1em; - margin-left: 0; -} -a.tabledrag-handle:hover { - text-decoration: none; -} -a.tabledrag-handle .handle { - background: url(../../../misc/icons/787878/move.svg) no-repeat 6px 7px; - height: 14px; - margin: -0.4em 0.5em 0; - padding: 0.42em 0.5em; - width: 14px; -} -a.tabledrag-handle:hover .handle, -a.tabledrag-handle:focus .handle { - background-image: url(../../../misc/icons/000000/move.svg); -} -.touch .draggable td { - padding: 0 10px; -} -.touch .draggable .menu-item__link { - display: inline-block; - padding: 10px 0; -} -.touch a.tabledrag-handle { - height: 44px; - width: 40px; -} -.touch a.tabledrag-handle .handle { - background-position: 40% 19px; - height: 21px; -} -.touch .draggable.drag a.tabledrag-handle .handle { - background-position: 50% -32px; -} -.indentation { - float: left; /* LTR */ - height: 1.7em; - margin: -0.4em 0.2em -0.4em -0.4em; /* LTR */ - padding: 0.42em 0 0.42em 0.6em; /* LTR */ - width: 20px; -} -[dir="rtl"] .indentation { - float: right; - margin: -0.4em -0.4em -0.4em 0.2em; - padding: 0.42em 0.6em 0.42em 0; -} -div.tree-child { - background: url(../../../misc/tree.png) no-repeat 11px center; /* LTR */ -} -div.tree-child-last { - background: url(../../../misc/tree-bottom.png) no-repeat 11px center; /* LTR */ -} -[dir="rtl"] div.tree-child, -[dir="rtl"] div.tree-child-last { - background-position: -65px center; -} -div.tree-child-horizontal { - background: url(../../../misc/tree.png) no-repeat -11px center; -} -.tabledrag-toggle-weight-wrapper { - text-align: right; /* LTR */ -} -[dir="rtl"] .tabledrag-toggle-weight-wrapper { - text-align: left; -} - -/** - * TableHeader behavior. - * - * @see tableheader.js - */ -table.sticky-header { - background-color: #fff; - margin-top: 0; - z-index: 500; - top: 0; -} - -/** - * Progress behavior. - * - * @see progress.js - */ -.progress { - position: relative; -} -.progress__track { - background-color: #fff; - border: 1px solid; - margin-top: 5px; - max-width: 100%; - min-width: 100px; - height: 16px; -} -.progress__bar { - background-color: #000; - height: 1.5em; - min-width: 3%; - max-width: 100%; -} -.progress__description, -.progress__percentage { - color: #555; - overflow: hidden; - font-size: .875em; - margin-top: 0.2em; -} -.progress__description { - float: left; /* LTR */ -} -[dir="rtl"] .progress__description { - float: right; -} -.progress__percentage { - float: right; /* LTR */ -} -[dir="rtl"] .progress__percentage { - float: left; -} -.progress--small .progress__track { - height: 7px; -} -.progress--small .progress__bar { - height: 7px; - background-size: 20px 20px; -} - -/* Throbber */ -.ajax-progress { - display: inline-block; - padding: 1px 5px 2px 5px; -} -[dir="rtl"] .ajax-progress { - float: right; -} -.ajax-progress-throbber .throbber { - background: transparent url(../../../misc/throbber-active.gif) no-repeat 0px center; - display: inline; - padding: 1px 5px 2px; -} -.ajax-progress-throbber .message { - display: inline; - padding: 1px 5px 2px; -} -tr .ajax-progress-throbber .throbber { - margin: 0 2px; -} -.ajax-progress-bar { - width: 16em; -} - -/* Full screen throbber */ -.ajax-progress-fullscreen { - /* Can't do center:50% middle: 50%, so approximate it for a typical window size. */ - left: 49%; - position: fixed; - top: 48.5%; - z-index: 1000; - background-color: #232323; - background-image: url("../../../misc/loading-small.gif"); - background-position: center center; - background-repeat: no-repeat; - border-radius: 7px; - height: 24px; - opacity: 0.9; - padding: 4px; - width: 24px; -} - -/** - * Inline items. - */ -.container-inline div, -.container-inline label { - display: inline; -} -/* Details contents always need to be rendered as block. */ -.container-inline .details-wrapper { - display: block; -} -/* Display form elements horizontally. */ -.form--inline .form-item { - float: left; /* LTR */ - margin-right: 0.5em; /* LTR */ -} -[dir="rtl"] .form--inline .form-item { - float: right; - margin-right: 0; - margin-left: 0.5em; -} -.form--inline .form-item-separator { - margin-top: 2.3em; - margin-right: 1em; /* LTR */ - margin-left: 0.5em; /* LTR */ -} -[dir="rtl"] .form--inline .form-item-separator { - margin-right: 0.5em; - margin-left: 1em; -} -.form--inline .form-actions { - clear: left; /* LTR */ -} -[dir="rtl"] .form--inline .form-actions { - clear: right; -} - - -/** - * Prevent text wrapping. - */ -.nowrap { - white-space: nowrap; -} - -/** - * For anything you want to hide on page load when JS is enabled, so - * that you can use the JS to control visibility and avoid flicker. - */ -.js .js-hide { - display: none; -} - -/** - * For anything you want to show on page load only when JS is enabled. - */ -.js-show { - display: none; -} -.js .js-show { - display: block; -} - -/** - * Hide elements from all users. - * - * Used for elements which should not be immediately displayed to any user. An - * example would be collapsible details that will be expanded with a click - * from a user. The effect of this class can be toggled with the jQuery show() - * and hide() functions. - */ -.hidden { - display: none; -} - -/** - * Hide elements visually, but keep them available for screen readers. - * - * Used for information required for screen reader users to understand and use - * the site where visual display is undesirable. Information provided in this - * manner should be kept concise, to avoid unnecessary burden on the user. - * "!important" is used to prevent unintentional overrides. - */ -.visually-hidden { - position: absolute !important; - clip: rect(1px, 1px, 1px, 1px); - overflow: hidden; - height: 1px; - width: 1px; - word-wrap: normal; -} - -/** - * The .focusable class extends the .visually-hidden class to allow - * the element to be focusable when navigated to via the keyboard. - */ -.visually-hidden.focusable:active, -.visually-hidden.focusable:focus { - position: static !important; - clip: auto; - overflow: visible; - height: auto; - width: auto; -} - -/** - * Hide visually and from screen readers, but maintain layout. - */ -.invisible { - visibility: hidden; -} - -/** - * Float clearing. - * - * Based on the micro clearfix hack by Nicolas Gallagher, with the :before - * pseudo selector removed to allow normal top margin collapse. - * - * @see http://nicolasgallagher.com/micro-clearfix-hack - */ -.clearfix:after { - content: ""; - display: table; - clear: both; -} - -/** - * Text alignment classes. - */ -.text-align-left { - text-align: left; -} -.text-align-right { - text-align: right; -} -.text-align-center { - text-align: center; -} -.text-align-justify { - text-align: justify; -} - -/** - * Alignment classes (images, videos, blockquotes …). - */ -.align-left { - float: left; -} -.align-right { - float: right; -} -.align-center { - display: block; - margin-left: auto; - margin-right: auto; -} - -/* - * Remove browser styles, especially for and so on. - */ -.reset-appearance { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - border: 0 none; - background: transparent; - padding: 0; - margin: 0; - line-height: inherit; -} - -/* - * Contain positioned elements. - */ -.position-container { - position: relative; -} diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css deleted file mode 100644 index 3a8bddbf6..000000000 --- a/core/modules/system/css/system.theme.css +++ /dev/null @@ -1,616 +0,0 @@ -/** - * @file - * Basic styling for common markup. - */ - -/** - * Publishing status. - */ -.node--unpublished { - background-color: #fff4f4; -} - -/** - * Markup generated by tablesort-indicator.html.twig. - */ -th.is-active img { - display: inline; -} -td.is-active { - background-color: #ddd; -} - -/** - * Markup generated by item-list.html.twig. - */ -.item-list .title { - font-weight: bold; -} -.item-list ul { - margin: 0 0 0.75em 0; - padding: 0; -} -.item-list ul li { - margin: 0 0 0.25em 1.5em; /* LTR */ - padding: 0; -} -[dir="rtl"] .item-list ul li { - margin: 0 1.5em 0.25em 0; -} - -/** - * Markup generated by Form API. - */ -.form-item, -.form-actions { - margin-top: 1em; - margin-bottom: 1em; -} -tr.odd .form-item, -tr.even .form-item { - margin-top: 0; - margin-bottom: 0; -} -.form-composite > .fieldset-wrapper > .description, -.form-item .description { - font-size: 0.85em; -} -label.option { - display: inline; - font-weight: normal; -} -.form-composite > legend, -.label { - display:inline; - font-size: inherit; - font-weight: bold; - margin: 0; - padding: 0; -} -.form-checkboxes .form-item, -.form-radios .form-item { - margin-top: 0.4em; - margin-bottom: 0.4em; -} -.form-type-radio .description, -.form-type-checkbox .description { - margin-left: 2.4em; -} -.marker { - color: #e00; -} - -.form-required:after { - content: ''; - vertical-align: super; - display: inline-block; - /* Use a background image to prevent screen readers from announcing the text. */ - background-image: url(../../../misc/icons/ee0000/required.svg); - background-repeat: no-repeat; - background-size: 6px 6px; - width: 6px; - height: 6px; - margin: 0 0.3em; -} - -abbr.tabledrag-changed, -abbr.ajax-changed { - border-bottom: none; -} -.form-item input.error, -.form-item textarea.error, -.form-item select.error { - border: 2px solid red; -} -.button, -.image-button { - margin-left: 1em; - margin-right: 1em; -} -.button:first-child, -.image-button:first-child { - margin-left: 0; - margin-right: 0; -} - -/* Inline error messages. */ -.form-item--error-message:before { - content: ''; - display: inline-block; - height: 14px; - width: 14px; - vertical-align: sub; - background: url(../../../misc/icons/ea2800/error.svg) no-repeat; - background-size: contain; -} - -/** - * Inline items. - */ -.container-inline label:after, -.container-inline .label:after { - content: ':'; -} -.form-type-radios .container-inline label:after { - content: ''; -} -.form-type-radios .container-inline .form-type-radio { - margin: 0 1em; -} -.container-inline .form-actions, -.container-inline.form-actions { - margin-top: 0; - margin-bottom: 0; -} - -/** - * Markup generated by #type 'more_link'. - */ -.more-link { - display: block; - text-align: right; /* LTR */ -} -[dir="rtl"] .more-link { - text-align: left; -} - -/* Style for the help icon. */ -.icon-help { - background: url(../../../misc/help.png) 0 50% no-repeat; /* LTR */ - padding: 1px 0 1px 20px; /* LTR */ -} -[dir="rtl"] .icon-help { - background-position: 100% 50%; - padding: 1px 20px 1px 0; -} - -/** - * Feed Icon. - * Markup generated by feed-icon.html.twig. - */ -.feed-icon { - background: url(../../../misc/feed.png) no-repeat; - overflow: hidden; - text-indent: -9999px; - display: block; - width: 16px; - height: 16px; -} - -/** - * Markup generated by pager.html.twig. - */ -.pager__items { - clear: both; - text-align: center; -} -.pager__item { - display: inline; - padding: 0.5em; -} -.pager__item.is-active { - font-weight: bold; -} - -/** - * Show buttons as links. - */ -button.link { - background: transparent; - border: 0; - cursor: pointer; - margin: 0; - padding: 0; - font-size: 1em; -} - -label button.link { - font-weight: bold; -} - -/** - * Collapsible details. - * - * @see collapse.js - * @thanks http://nicolasgallagher.com/css-background-image-hacks/ - */ -details { - border: 1px solid #ccc; - margin-top: 1em; - margin-bottom: 1em; -} -details > .details-wrapper { - padding: 0.5em 1.5em; -} -/* @todo Regression: The summary of uncollapsible details are no longer - vertically aligned with the .details-wrapper in browsers without native - details support. */ -summary { - cursor: pointer; - padding: 0.2em 0.5em; -} -.collapse-processed > summary { - padding-left: 0.5em; - padding-right: 0.5em; -} -.collapse-processed > summary:before { - background: url(../../../misc/menu-expanded.png) 0px 100% no-repeat; /* LTR */ - content: ""; - float: left; - height: 1em; - width: 1em; -} -[dir="rtl"] .collapse-processed > summary:before { - background-position: 100% 100%; - float: right; -} -.collapse-processed:not([open]) > summary:before { - background-position: 25% 35%; /* LTR */ - -ms-transform: rotate(-90deg); - -webkit-transform: rotate(-90deg); - transform: rotate(-90deg); -} -[dir="rtl"] .collapse-processed:not([open]) > summary:before { - background-position: 75% 35%; - -ms-transform: rotate(90deg); - -webkit-transform: rotate(90deg); - transform: rotate(90deg); -} - -/** - * TableDrag behavior. - * - * @see tabledrag.js - */ -tr.drag { - background-color: #fffff0; -} -tr.drag-previous { - background-color: #ffd; -} -body div.tabledrag-changed-warning { - margin-bottom: 0.5em; -} - -/** - * TableSelect behavior. - * - * @see tableselect.js - */ -tr.selected td { - background: #ffc; -} -td.checkbox, -th.checkbox { - text-align: center; -} - -/** - * Progress bar. - * - * @see progress.js - */ -.progress__track { - border-color: #b3b3b3; - border-radius: 10em; - background-color: #f2f1eb; - background-image: -webkit-linear-gradient(#e7e7df, #f0f0f0); - background-image: linear-gradient(#e7e7df, #f0f0f0); - box-shadow: inset 0 1px 3px hsla(0, 0%, 0%, 0.16); -} -.progress__bar { - border: 1px #07629a solid; - background: #057ec9; - background-image: - -webkit-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ), - -webkit-linear-gradient( left top, - #0094f0 0%, - #0094f0 25%, - #007ecc 25%, - #007ecc 50%, - #0094f0 50%, - #0094f0 75%, - #0094f0 100% ); - background-image: - -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)), -webkit-linear-gradient(left top, #0094f0 0%, #0094f0 25%, #007ecc 25%, #007ecc 50%, #0094f0 50%, #0094f0 75%, #0094f0 100%); - background-image: - linear-gradient( to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ), - linear-gradient( to right bottom, - #0094f0 0%, - #0094f0 25%, - #007ecc 25%, - #007ecc 50%, - #0094f0 50%, - #0094f0 75%, - #0094f0 100% ); - background-size: 40px 40px; - margin-top: -1px; - margin-left: -1px; - padding: 0 1px; - width: 3%; - height: 16px; - border-radius: 10em; - -webkit-animation: animate-stripes 3s linear infinite; - -moz-animation: animate-stripes 3s linear infinite; - -webkit-transition: width 0.5s ease-out; - transition: width 0.5s ease-out; -} - -/** - * Progress bar animations. - */ -@-webkit-keyframes animate-stripes { - 0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;} -} -@-ms-keyframes animate-stripes { - 0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;} -} -@keyframes animate-stripes { - 0% {background-position: 0 0, 0 0;} 100% {background-position: 0 0, -80px 0;} -} - -/** - * Markup generated by menu.html.twig. - */ -ul.menu { - list-style: none outside; - margin-left: 1em; /* LTR */ - padding: 0; - text-align: left; /* LTR */ -} -[dir="rtl"] ul.menu { - margin-left: 0; - margin-right: 1em; - text-align: right; -} -.menu-item--expanded { - list-style-image: url(../../../misc/menu-expanded.png); - list-style-type: circle; -} -.menu-item--collapsed { - list-style-image: url(../../../misc/menu-collapsed.png); /* LTR */ - list-style-type: disc; -} -[dir="rtl"] .menu-item--collapsed { - list-style-image: url(../../../misc/menu-collapsed-rtl.png); -} -.menu-item { - padding-top: 0.2em; - margin: 0; -} -ul.menu a.is-active { - color: #000; -} - -/** - * Markup generated by links.html.twig. - */ -ul.inline, -ul.links.inline { - display: inline; - padding-left: 0; -} -ul.inline li { - display: inline; - list-style-type: none; - padding: 0 0.5em; -} -ul.links a.is-active { - color: #000; -} - -/** - * Markup generated by breadcrumb.html.twig. - */ -.breadcrumb { - padding-bottom: 0.5em; -} -.breadcrumb ol { - margin: 0; - padding: 0; -} -[dir="rtl"] .breadcrumb ol { - /* This is required to win over specifity of [dir="rtl"] ol */ - margin-right: 0; -} -.breadcrumb li { - display: inline; - list-style-type: none; - margin: 0; - padding: 0; -} -/* IE8 does not support :not() and :last-child. */ -.breadcrumb li:before { - content: ' \BB '; -} -.breadcrumb li:first-child:before { - content: none; -} - -/** - * Markup generated by menu-local-tasks.html.twig. - */ -div.tabs { - margin: 1em 0; -} -ul.tabs { - list-style: none; - margin: 0 0 0.5em; - padding: 0; -} -.tabs > li { - display: inline-block; - margin-right: 0.3em; /* LTR */ -} -[dir="rtl"] .tabs > li { - margin-left: 0.3em; - margin-right: 0; -} -.tabs a { - display: block; - padding: 0.2em 1em; - text-decoration: none; -} -.tabs a.is-active { - background-color: #eee; -} -.tabs a:focus, -.tabs a:hover { - background-color: #f5f5f5; -} - -/** - * Styles for link buttons and action links. - */ -.action-links { - list-style: none; - padding: 0; - margin: 1em 0; -} -[dir="rtl"] .action-links { - /* This is required to win over specifity of [dir="rtl"] ul */ - margin-right: 0; -} -.action-links li { - display: inline-block; - margin: 0 0.3em; -} -.action-links li:first-child { - margin-left: 0; /* LTR */ -} -[dir="rtl"] .action-links li:first-child { - margin-left: 0.3em; - margin-right: 0; -} -.button-action { - display: inline-block; - line-height: 160%; - padding: 0.2em 0.5em 0.3em; - text-decoration: none; -} -.button-action:before { - content: '+'; - font-weight: 900; - margin-left: -0.1em; /* LTR */ - padding-right: 0.2em; /* LTR */ -} -[dir="rtl"] .button-action:before { - margin-left: 0; - margin-right: -0.1em; - padding-left: 0.2em; - padding-right: 0; -} - -/** - * Styles for system messages. - */ -.messages { - background: no-repeat 10px 17px; /* LTR */ - border: 1px solid; - border-width: 1px 1px 1px 0; /* LTR */ - border-radius: 2px; - padding: 15px 20px 15px 35px; /* LTR */ - word-wrap: break-word; - overflow-wrap: break-word; -} -[dir="rtl"] .messages { - border-width: 1px 0 1px 1px; - background-position: right 10px top 17px; - padding-left: 20px; - padding-right: 35px; - text-align: right; -} -.messages + .messages { - margin-top: 1.538em; -} -.messages__list { - list-style: none; - padding: 0; - margin: 0; -} -.messages__item + .messages__item { - margin-top: 0.769em; -} - -/* See .color-success in Seven's colors.css */ -.messages--status { - color: #325e1c; - background-color: #f3faef; - border-color: #c9e1bd #c9e1bd #c9e1bd transparent; /* LTR */ - background-image: url(../../../misc/icons/73b355/check.svg); - box-shadow: -8px 0 0 #77b259; /* LTR */ -} -[dir="rtl"] .messages--status { - border-color: #c9e1bd transparent #c9e1bd #c9e1bd; - box-shadow: 8px 0 0 #77b259; - margin-left: 0; -} - -/* See .color-warning in Seven's colors.css */ -.messages--warning { - background-color: #fdf8ed; - background-image: url(../../../misc/icons/e29700/warning.svg); - border-color: #f4daa6 #f4daa6 #f4daa6 transparent; /* LTR */ - color: #734c00; - box-shadow: -8px 0 0 #e09600; /* LTR */ -} -[dir="rtl"] .messages--warning { - border-color: #f4daa6 transparent #f4daa6 #f4daa6; - box-shadow: 8px 0 0 #e09600; -} - -/* See .color-error in Seven's colors.css */ -.messages--error { - background-color: #fcf4f2; - color: #a51b00; - background-image: url(../../../misc/icons/ea2800/error.svg); - border-color: #f9c9bf #f9c9bf #f9c9bf transparent; /* LTR */ - box-shadow: -8px 0 0 #e62600; /* LTR */ -} -[dir="rtl"] .messages--error { - border-color: #f9c9bf transparent #f9c9bf #f9c9bf; - box-shadow: 8px 0 0 #e62600; -} -.messages--error p.error { - color: #a51b00; -} - -/* Field display */ -.field .field-label { - font-weight: bold; -} -.field-label-inline .field-label, -.field-label-inline .field-items { - float:left; /*LTR*/ - margin-right: 0.5em; /*LTR*/ -} -[dir="rtl"] .field-label-inline .field-label, -[dir="rtl"] .field-label-inline .field-items { - float: right; - margin-left: 0.5em; - margin-right: 0; -} -.field-label-inline .field-label::after { - content: ':'; -} - -/* Form display */ -form .field-multiple-table { - margin: 0; -} -form .field-multiple-table .field-multiple-drag { - width: 30px; - padding-right: 0; /*LTR*/ -} -[dir="rtl"] form .field-multiple-table .field-multiple-drag { - padding-left: 0; -} -form .field-multiple-table .field-multiple-drag .tabledrag-handle { - padding-right: .5em; /*LTR*/ -} -[dir="rtl"] form .field-multiple-table .field-multiple-drag .tabledrag-handle { - padding-left: .5em; -} -form .field-add-more-submit { - margin: .5em 0 0; -} diff --git a/core/modules/system/migration_templates/d6_menu.yml b/core/modules/system/migration_templates/d6_menu.yml deleted file mode 100644 index 0d353c22e..000000000 --- a/core/modules/system/migration_templates/d6_menu.yml +++ /dev/null @@ -1,12 +0,0 @@ -id: d6_menu -label: Drupal 6 menus -migration_tags: - - Drupal 6 -source: - plugin: d6_menu -process: - id: menu_name - label: title - description: description -destination: - plugin: entity:menu diff --git a/core/modules/system/src/FileAjaxForm.php b/core/modules/system/src/FileAjaxForm.php deleted file mode 100644 index 0400f7fce..000000000 --- a/core/modules/system/src/FileAjaxForm.php +++ /dev/null @@ -1,122 +0,0 @@ -form = $form; - $this->formState = $form_state; - $this->formId = $form_id; - $this->formBuildId = $form_build_id; - $this->commands = $commands; - } - - /** - * Gets all AJAX commands. - * - * @return \Drupal\Core\Ajax\CommandInterface[] - * Returns all previously added AJAX commands. - */ - public function getCommands() { - return $this->commands; - } - - /** - * Gets the form definition. - * - * @return array - */ - public function getForm() { - return $this->form; - } - - /** - * Gets the unique form build ID. - * - * @return string - */ - public function getFormBuildId() { - return $this->formBuildId; - } - - /** - * Gets the unique form ID. - * - * @return string - */ - public function getFormId() { - return $this->formId; - } - - /** - * Gets the form state. - * - * @return \Drupal\Core\Form\FormStateInterface - */ - public function getFormState() { - return $this->formState; - } - -} diff --git a/core/modules/system/src/Tests/Extension/InfoParserUnitTest.php b/core/modules/system/src/Tests/Extension/InfoParserUnitTest.php deleted file mode 100644 index 767e0a1c3..000000000 --- a/core/modules/system/src/Tests/Extension/InfoParserUnitTest.php +++ /dev/null @@ -1,87 +0,0 @@ -infoParser = new InfoParser(); - } - - /** - * Tests the functionality of the infoParser object. - */ - public function testInfoParser() { - $info = $this->infoParser->parse('core/modules/system/tests/fixtures/does_not_exist.info.txt'); - $this->assertTrue(empty($info), 'Non existing info.yml returns empty array.'); - - // Test that invalid YAML throws an exception and that message contains the - // filename that caused it. - $filename = 'core/modules/system/tests/fixtures/broken.info.txt'; - try { - $this->infoParser->parse($filename); - $this->fail('Expected InfoParserException not thrown when reading broken.info.txt'); - } - catch (InfoParserException $e) { - $this->assertTrue(strpos($e->getMessage(), $filename) !== FALSE, 'Exception message contains info.yml filename.'); - } - - // Tests that missing required keys are detected. - $filename = 'core/modules/system/tests/fixtures/missing_keys.info.txt'; - try { - $this->infoParser->parse($filename); - $this->fail('Expected InfoParserException not thrown when reading missing_keys.info.txt'); - } - catch (InfoParserException $e) { - $expected_message = "Missing required keys (type, core, name) in $filename."; - $this->assertEqual($e->getMessage(), $expected_message); - } - - // Tests that a single missing required key is detected. - $filename = 'core/modules/system/tests/fixtures/missing_key.info.txt'; - try { - $this->infoParser->parse($filename); - $this->fail('Expected InfoParserException not thrown when reading missing_key.info.txt'); - } - catch (InfoParserException $e) { - $expected_message = "Missing required keys (type) in $filename."; - $this->assertEqual($e->getMessage(), $expected_message); - } - - $info_values = $this->infoParser->parse('core/modules/system/tests/fixtures/common_test.info.txt'); - $this->assertEqual($info_values['simple_string'], 'A simple string', 'Simple string value was parsed correctly.', 'System'); - $this->assertEqual($info_values['version'], \Drupal::VERSION, 'Constant value was parsed correctly.', 'System'); - $this->assertEqual($info_values['double_colon'], 'dummyClassName::', 'Value containing double-colon was parsed correctly.', 'System'); - } - -} diff --git a/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php b/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php deleted file mode 100644 index 743594952..000000000 --- a/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php +++ /dev/null @@ -1,343 +0,0 @@ -register('router.dumper', 'Drupal\Core\Routing\NullMatcherDumper'); - } - - /** - * The basic functionality of retrieving enabled modules. - */ - function testModuleList() { - // Prime the drupal_get_filename() static cache with the location of the - // testing profile as it is not the currently active profile and we don't - // yet have any cached way to retrieve its location. - // @todo Remove as part of https://www.drupal.org/node/2186491 - drupal_get_filename('profile', 'testing', 'core/profiles/testing/testing.info.yml'); - // Build a list of modules, sorted alphabetically. - $profile_info = install_profile_info('testing', 'en'); - $module_list = $profile_info['dependencies']; - - // Installation profile is a module that is expected to be loaded. - $module_list[] = 'testing'; - - sort($module_list); - // Compare this list to the one returned by the module handler. We expect - // them to match, since all default profile modules have a weight equal to 0 - // (except for block.module, which has a lower weight but comes first in - // the alphabet anyway). - $this->assertModuleList($module_list, 'Testing profile'); - - // Try to install a new module. - $this->moduleInstaller()->install(array('ban')); - $module_list[] = 'ban'; - sort($module_list); - $this->assertModuleList($module_list, 'After adding a module'); - - // Try to mess with the module weights. - module_set_weight('ban', 20); - - // Move ban to the end of the array. - unset($module_list[array_search('ban', $module_list)]); - $module_list[] = 'ban'; - $this->assertModuleList($module_list, 'After changing weights'); - - // Test the fixed list feature. - $fixed_list = array( - 'system' => 'core/modules/system/system.module', - 'menu' => 'core/modules/menu/menu.module', - ); - $this->moduleHandler()->setModuleList($fixed_list); - $new_module_list = array_combine(array_keys($fixed_list), array_keys($fixed_list)); - $this->assertModuleList($new_module_list, t('When using a fixed list')); - } - - /** - * Assert that the extension handler returns the expected values. - * - * @param array $expected_values - * The expected values, sorted by weight and module name. - * @param $condition - */ - protected function assertModuleList(Array $expected_values, $condition) { - $expected_values = array_values(array_unique($expected_values)); - $enabled_modules = array_keys($this->container->get('module_handler')->getModuleList()); - $enabled_modules = sort($enabled_modules); - $this->assertEqual($expected_values, $enabled_modules, format_string('@condition: extension handler returns correct results', array('@condition' => $condition))); - } - - /** - * Tests dependency resolution. - * - * Intentionally using fake dependencies added via hook_system_info_alter() - * for modules that normally do not have any dependencies. - * - * To simplify things further, all of the manipulated modules are either - * purely UI-facing or live at the "bottom" of all dependency chains. - * - * @see module_test_system_info_alter() - * @see https://www.drupal.org/files/issues/dep.gv__0.png - */ - function testDependencyResolution() { - $this->enableModules(array('module_test')); - $this->assertTrue($this->moduleHandler()->moduleExists('module_test'), 'Test module is enabled.'); - - // Ensure that modules are not enabled. - $this->assertFalse($this->moduleHandler()->moduleExists('color'), 'Color module is disabled.'); - $this->assertFalse($this->moduleHandler()->moduleExists('config'), 'Config module is disabled.'); - $this->assertFalse($this->moduleHandler()->moduleExists('help'), 'Help module is disabled.'); - - // Create a missing fake dependency. - // Color will depend on Config, which depends on a non-existing module Foo. - // Nothing should be installed. - \Drupal::state()->set('module_test.dependency', 'missing dependency'); - drupal_static_reset('system_rebuild_module_data'); - - try { - $result = $this->moduleInstaller()->install(array('color')); - $this->fail(t('ModuleInstaller::install() throws an exception if dependencies are missing.')); - } - catch (\Drupal\Core\Extension\MissingDependencyException $e) { - $this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.')); - } - - $this->assertFalse($this->moduleHandler()->moduleExists('color'), 'ModuleHandler::install() aborts if dependencies are missing.'); - - // Fix the missing dependency. - // Color module depends on Config. Config depends on Help module. - \Drupal::state()->set('module_test.dependency', 'dependency'); - drupal_static_reset('system_rebuild_module_data'); - - $result = $this->moduleInstaller()->install(array('color')); - $this->assertTrue($result, 'ModuleHandler::install() returns the correct value.'); - - // Verify that the fake dependency chain was installed. - $this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.'); - - // Verify that the original module was installed. - $this->assertTrue($this->moduleHandler()->moduleExists('color'), 'Module installation with dependencies succeeded.'); - - // Verify that the modules were enabled in the correct order. - $module_order = \Drupal::state()->get('module_test.install_order') ?: array(); - $this->assertEqual($module_order, array('help', 'config', 'color')); - - // Uninstall all three modules explicitly, but in the incorrect order, - // and make sure that ModuleHandler::uninstall() uninstalled them in the - // correct sequence. - $result = $this->moduleInstaller()->uninstall(array('config', 'help', 'color')); - $this->assertTrue($result, 'ModuleHandler::uninstall() returned TRUE.'); - - foreach (array('color', 'config', 'help') as $module) { - $this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, "$module module was uninstalled."); - } - $uninstalled_modules = \Drupal::state()->get('module_test.uninstall_order') ?: array(); - $this->assertEqual($uninstalled_modules, array('color', 'config', 'help'), 'Modules were uninstalled in the correct order.'); - - // Enable Color module again, which should enable both the Config module and - // Help module. But, this time do it with Config module declaring a - // dependency on a specific version of Help module in its info file. Make - // sure that Drupal\Core\Extension\ModuleHandler::install() still works. - \Drupal::state()->set('module_test.dependency', 'version dependency'); - drupal_static_reset('system_rebuild_module_data'); - - $result = $this->moduleInstaller()->install(array('color')); - $this->assertTrue($result, 'ModuleHandler::install() returns the correct value.'); - - // Verify that the fake dependency chain was installed. - $this->assertTrue($this->moduleHandler()->moduleExists('config') && $this->moduleHandler()->moduleExists('help'), 'Dependency chain was installed.'); - - // Verify that the original module was installed. - $this->assertTrue($this->moduleHandler()->moduleExists('color'), 'Module installation with version dependencies succeeded.'); - - // Finally, verify that the modules were enabled in the correct order. - $enable_order = \Drupal::state()->get('module_test.install_order') ?: array(); - $this->assertIdentical($enable_order, array('help', 'config', 'color')); - } - - /** - * Tests uninstalling a module that is a "dependency" of a profile. - */ - function testUninstallProfileDependency() { - $profile = 'minimal'; - $dependency = 'dblog'; - $this->settingsSet('install_profile', $profile); - // Prime the drupal_get_filename() static cache with the location of the - // minimal profile as it is not the currently active profile and we don't - // yet have any cached way to retrieve its location. - // @todo Remove as part of https://www.drupal.org/node/2186491 - drupal_get_filename('profile', $profile, 'core/profiles/' . $profile . '/' . $profile . '.info.yml'); - $this->enableModules(array('module_test', $profile)); - - drupal_static_reset('system_rebuild_module_data'); - $data = system_rebuild_module_data(); - $this->assertTrue(isset($data[$profile]->requires[$dependency])); - - $this->moduleInstaller()->install(array($dependency)); - $this->assertTrue($this->moduleHandler()->moduleExists($dependency)); - - // Uninstall the profile module "dependency". - $result = $this->moduleInstaller()->uninstall(array($dependency)); - $this->assertTrue($result, 'ModuleHandler::uninstall() returns TRUE.'); - $this->assertFalse($this->moduleHandler()->moduleExists($dependency)); - $this->assertEqual(drupal_get_installed_schema_version($dependency), SCHEMA_UNINSTALLED, "$dependency module was uninstalled."); - - // Verify that the installation profile itself was not uninstalled. - $uninstalled_modules = \Drupal::state()->get('module_test.uninstall_order') ?: array(); - $this->assertTrue(in_array($dependency, $uninstalled_modules), "$dependency module is in the list of uninstalled modules."); - $this->assertFalse(in_array($profile, $uninstalled_modules), 'The installation profile is not in the list of uninstalled modules.'); - } - - /** - * Tests uninstalling a module that has content. - */ - function testUninstallContentDependency() { - $this->enableModules(array('module_test', 'entity_test', 'text', 'user', 'help')); - $this->assertTrue($this->moduleHandler()->moduleExists('entity_test'), 'Test module is enabled.'); - $this->assertTrue($this->moduleHandler()->moduleExists('module_test'), 'Test module is enabled.'); - - $this->installSchema('user', 'users_data'); - $entity_types = \Drupal::entityManager()->getDefinitions(); - foreach ($entity_types as $entity_type) { - if ('entity_test' == $entity_type->getProvider()) { - $this->installEntitySchema($entity_type->id()); - } - } - - // Create a fake dependency. - // entity_test will depend on help. This way help can not be uninstalled - // when there is test content preventing entity_test from being uninstalled. - \Drupal::state()->set('module_test.dependency', 'dependency'); - drupal_static_reset('system_rebuild_module_data'); - - // Create an entity so that the modules can not be disabled. - $entity = entity_create('entity_test', array('name' => $this->randomString())); - $entity->save(); - - // Uninstalling entity_test is not possible when there is content. - try { - $message = 'ModuleHandler::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.'; - $this->moduleInstaller()->uninstall(array('entity_test')); - $this->fail($message); - } - catch (ModuleUninstallValidatorException $e) { - $this->pass(get_class($e) . ': ' . $e->getMessage()); - } - - // Uninstalling help needs entity_test to be un-installable. - try { - $message = 'ModuleHandler::uninstall() throws ModuleUninstallValidatorException upon uninstalling a module which does not pass validation.'; - $this->moduleInstaller()->uninstall(array('help')); - $this->fail($message); - } - catch (ModuleUninstallValidatorException $e) { - $this->pass(get_class($e) . ': ' . $e->getMessage()); - } - - // Deleting the entity. - $entity->delete(); - - $result = $this->moduleInstaller()->uninstall(array('help')); - $this->assertTrue($result, 'ModuleHandler::uninstall() returns TRUE.'); - $this->assertEqual(drupal_get_installed_schema_version('entity_test'), SCHEMA_UNINSTALLED, "entity_test module was uninstalled."); - } - - /** - * Tests whether the correct module metadata is returned. - */ - function testModuleMetaData() { - // Generate the list of available modules. - $modules = system_rebuild_module_data(); - // Check that the mtime field exists for the system module. - $this->assertTrue(!empty($modules['system']->info['mtime']), 'The system.info.yml file modification time field is present.'); - // Use 0 if mtime isn't present, to avoid an array index notice. - $test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0; - // Ensure the mtime field contains a number that is greater than zero. - $this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The system.info.yml file modification time field contains a timestamp.'); - } - - /** - * Tests whether module-provided stream wrappers are registered properly. - */ - public function testModuleStreamWrappers() { - // file_test.module provides (among others) a 'dummy' stream wrapper. - // Verify that it is not registered yet to prevent false positives. - $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(); - $this->assertFalse(isset($stream_wrappers['dummy'])); - $this->moduleInstaller()->install(['file_test']); - // Verify that the stream wrapper is available even without calling - // \Drupal::service('stream_wrapper_manager')->getWrappers() again. - // If the stream wrapper is not available file_exists() will raise a notice. - file_exists('dummy://'); - $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(); - $this->assertTrue(isset($stream_wrappers['dummy'])); - } - - /** - * Tests whether the correct theme metadata is returned. - */ - function testThemeMetaData() { - // Generate the list of available themes. - $themes = \Drupal::service('theme_handler')->rebuildThemeData(); - // Check that the mtime field exists for the bartik theme. - $this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info.yml file modification time field is present.'); - // Use 0 if mtime isn't present, to avoid an array index notice. - $test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0; - // Ensure the mtime field contains a number that is greater than zero. - $this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The bartik.info.yml file modification time field contains a timestamp.'); - } - - /** - * Returns the ModuleHandler. - * - * @return \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected function moduleHandler() { - return $this->container->get('module_handler'); - } - - /** - * Returns the ModuleInstaller. - * - * @return \Drupal\Core\Extension\ModuleInstallerInterface - */ - protected function moduleInstaller() { - return $this->container->get('module_installer'); - } - -} diff --git a/core/modules/system/src/Tests/Migrate/d6/MigrateMenuTest.php b/core/modules/system/src/Tests/Migrate/d6/MigrateMenuTest.php deleted file mode 100644 index 279e2b7f5..000000000 --- a/core/modules/system/src/Tests/Migrate/d6/MigrateMenuTest.php +++ /dev/null @@ -1,59 +0,0 @@ -loadDumps(['MenuCustom.php']); - $this->executeMigration('d6_menu'); - } - - /** - * Tests the Drupal 6 menu to Drupal 8 migration. - */ - public function testMenu() { - $navigation_menu = Menu::load('navigation'); - $this->assertIdentical('navigation', $navigation_menu->id()); - $this->assertIdentical('Navigation', $navigation_menu->label()); - $expected = <<assertIdentical($expected, $navigation_menu->getDescription()); - - // Test that we can re-import using the ConfigEntityBase destination. - Database::getConnection('default', 'migrate') - ->update('menu_custom') - ->fields(array('title' => 'Home Navigation')) - ->condition('menu_name', 'navigation') - ->execute(); - - db_truncate(entity_load('migration', 'd6_menu')->getIdMap()->mapTableName())->execute(); - $migration = entity_load_unchanged('migration', 'd6_menu'); - $executable = new MigrateExecutable($migration, $this); - $executable->import(); - - $navigation_menu = entity_load_unchanged('menu', 'navigation'); - $this->assertIdentical('Home Navigation', $navigation_menu->label()); - } - -} diff --git a/core/modules/system/tests/fixtures/broken.info.txt b/core/modules/system/tests/fixtures/broken.info.txt deleted file mode 100644 index dffbb0385..000000000 --- a/core/modules/system/tests/fixtures/broken.info.txt +++ /dev/null @@ -1,9 +0,0 @@ -# info.yml for testing broken YAML parsing exception handling. -name: File -type: module -description: 'Defines a file field type.' -package: Core -version: VERSION -core: 8.x -dependencies::;; - - field diff --git a/core/modules/system/tests/fixtures/common_test.info.txt b/core/modules/system/tests/fixtures/common_test.info.txt deleted file mode 100644 index 7e57dfe4b..000000000 --- a/core/modules/system/tests/fixtures/common_test.info.txt +++ /dev/null @@ -1,7 +0,0 @@ -core: 8.x -name: common_test -type: module -description: 'testing info file parsing' -simple_string: 'A simple string' -version: "VERSION" -double_colon: dummyClassName:: diff --git a/core/modules/system/tests/fixtures/missing_key.info.txt b/core/modules/system/tests/fixtures/missing_key.info.txt deleted file mode 100644 index 022b5f330..000000000 --- a/core/modules/system/tests/fixtures/missing_key.info.txt +++ /dev/null @@ -1,8 +0,0 @@ -# info.yml for testing missing type key. -name: File -description: 'Defines a file field type.' -package: Core -version: VERSION -core: 8.x -dependencies: - - field diff --git a/core/modules/system/tests/fixtures/missing_keys.info.txt b/core/modules/system/tests/fixtures/missing_keys.info.txt deleted file mode 100644 index c04f34d7c..000000000 --- a/core/modules/system/tests/fixtures/missing_keys.info.txt +++ /dev/null @@ -1,5 +0,0 @@ -# info.yml for testing missing name, description, and type keys. -package: Core -version: VERSION -dependencies: - - field diff --git a/core/modules/text/migration_templates/d6_text_settings.yml b/core/modules/text/migration_templates/d6_text_settings.yml deleted file mode 100644 index 8f6fff30b..000000000 --- a/core/modules/text/migration_templates/d6_text_settings.yml +++ /dev/null @@ -1,13 +0,0 @@ -id: d6_text_settings -label: Drupal 6 teaser length configuration -migration_tags: - - Drupal 6 -source: - plugin: variable - variables: - - teaser_length -process: - default_summary_length: teaser_length -destination: - plugin: config - config_name: text.settings diff --git a/core/modules/user/src/Tests/Views/UserUnitTestBase.php b/core/modules/user/src/Tests/Views/UserUnitTestBase.php deleted file mode 100644 index 433719f21..000000000 --- a/core/modules/user/src/Tests/Views/UserUnitTestBase.php +++ /dev/null @@ -1,95 +0,0 @@ -installEntitySchema('user'); - - $entity_manager = $this->container->get('entity.manager'); - $this->roleStorage = $entity_manager->getStorage('user_role'); - $this->userStorage = $entity_manager->getStorage('user'); - } - - /** - * Set some test data for permission related tests. - */ - protected function setupPermissionTestData() { - // Setup a role without any permission. - $this->roleStorage->create(array('id' => 'authenticated')) - ->save(); - $this->roleStorage->create(array('id' => 'no_permission')) - ->save(); - // Setup a role with just one permission. - $this->roleStorage->create(array('id' => 'one_permission')) - ->save(); - user_role_grant_permissions('one_permission', array('administer permissions')); - // Setup a role with multiple permissions. - $this->roleStorage->create(array('id' => 'multiple_permissions')) - ->save(); - user_role_grant_permissions('multiple_permissions', array('administer permissions', 'administer users', 'access user profiles')); - - // Setup a user without an extra role. - $this->users[] = $account = $this->userStorage->create(array()); - $account->save(); - // Setup a user with just the first role (so no permission beside the - // ones from the authenticated role). - $this->users[] = $account = $this->userStorage->create(array('name' => 'first_role')); - $account->addRole('no_permission'); - $account->save(); - // Setup a user with just the second role (so one additional permission). - $this->users[] = $account = $this->userStorage->create(array('name' => 'second_role')); - $account->addRole('one_permission'); - $account->save(); - // Setup a user with both the second and the third role. - $this->users[] = $account = $this->userStorage->create(array('name' => 'second_third_role')); - $account->addRole('one_permission'); - $account->addRole('multiple_permissions'); - $account->save(); - } - -} diff --git a/core/modules/views/src/Tests/Handler/FieldUnitTest.php b/core/modules/views/src/Tests/Handler/FieldUnitTest.php deleted file mode 100644 index 85fabe3da..000000000 --- a/core/modules/views/src/Tests/Handler/FieldUnitTest.php +++ /dev/null @@ -1,756 +0,0 @@ - 'name', - ); - - /** - * Overrides Drupal\views\Tests\ViewTestBase::viewsData(). - */ - protected function viewsData() { - $data = parent::viewsData(); - $data['views_test_data']['job']['field']['id'] = 'test_field'; - $data['views_test_data']['job']['field']['click sortable'] = FALSE; - $data['views_test_data']['id']['field']['click sortable'] = TRUE; - return $data; - } - - /** - * Tests that the render function is called. - */ - public function testRender() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = \Drupal::service('renderer'); - - $view = Views::getView('test_field_tokens'); - $this->executeView($view); - - $random_text = $this->randomMachineName(); - $view->field['job']->setTestValue($random_text); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['job']->theme($view->result[0]); - }); - $this->assertEqual($output, $random_text, 'Make sure the render method rendered the manual set value.'); - } - - /** - * Tests all things related to the query. - */ - public function testQuery() { - // Tests adding additional fields to the query. - $view = Views::getView('test_view'); - $view->initHandlers(); - - $id_field = $view->field['id']; - $id_field->additional_fields['job'] = 'job'; - // Choose also a field alias key which doesn't match to the table field. - $id_field->additional_fields['created_test'] = array('table' => 'views_test_data', 'field' => 'created'); - $view->build(); - - // Make sure the field aliases have the expected value. - $this->assertEqual($id_field->aliases['job'], 'views_test_data_job'); - $this->assertEqual($id_field->aliases['created_test'], 'views_test_data_created'); - - $this->executeView($view); - // Tests the getValue method with and without a field aliases. - foreach ($this->dataSet() as $key => $row) { - $id = $key + 1; - $result = $view->result[$key]; - $this->assertEqual($id_field->getValue($result), $id); - $this->assertEqual($id_field->getValue($result, 'job'), $row['job']); - $this->assertEqual($id_field->getValue($result, 'created_test'), $row['created']); - } - } - - /** - * Asserts that a string is part of another string. - * - * @param string $haystack - * The value to search in. - * @param string $needle - * The value to search for. - * @param string $message - * (optional) A message to display with the assertion. Do not translate - * messages: use format_string() to embed variables in the message text, not - * t(). If left blank, a default message will be displayed. - * @param string $group - * (optional) The group this message is in, which is displayed in a column - * in test output. Use 'Debug' to indicate this is debugging output. Do not - * translate this string. Defaults to 'Other'; most tests do not override - * this default. - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. - */ - protected function assertSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertTrue(strpos($haystack, $needle) !== FALSE, $message, $group); - } - - /** - * Asserts that a string is not part of another string. - * - * @param string $haystack - * The value to search in. - * @param string $needle - * The value to search for. - * @param string $message - * (optional) A message to display with the assertion. Do not translate - * messages: use format_string() to embed variables in the message text, not - * t(). If left blank, a default message will be displayed. - * @param string $group - * (optional) The group this message is in, which is displayed in a column - * in test output. Use 'Debug' to indicate this is debugging output. Do not - * translate this string. Defaults to 'Other'; most tests do not override - * this default. - * - * @return bool - * TRUE if the assertion succeeded, FALSE otherwise. - */ - protected function assertNotSubString($haystack, $needle, $message = '', $group = 'Other') { - return $this->assertTrue(strpos($haystack, $needle) === FALSE, $message, $group); - } - - /** - * Tests general rewriting of the output. - */ - public function testRewrite() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = \Drupal::service('renderer'); - - $view = Views::getView('test_view'); - $view->initHandlers(); - $this->executeView($view); - $row = $view->result[0]; - $id_field = $view->field['id']; - - // Don't check the rewrite checkbox, so the text shouldn't appear. - $id_field->options['alter']['text'] = $random_text = $this->randomMachineName(); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) { - return $id_field->theme($row); - }); - $this->assertNotSubString($output, $random_text); - - $id_field->options['alter']['alter_text'] = TRUE; - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) { - return $id_field->theme($row); - }); - $this->assertSubString($output, $random_text); - } - - /** - * Tests the field tokens, row level and field level. - */ - public function testFieldTokens() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = \Drupal::service('renderer'); - - $view = Views::getView('test_field_tokens'); - $this->executeView($view); - $name_field_0 = $view->field['name']; - $name_field_1 = $view->field['name_1']; - $name_field_2 = $view->field['name_2']; - $row = $view->result[0]; - - $name_field_0->options['alter']['alter_text'] = TRUE; - $name_field_0->options['alter']['text'] = '{{ name }}'; - - $name_field_1->options['alter']['alter_text'] = TRUE; - $name_field_1->options['alter']['text'] = '{{ name_1 }} {{ name }}'; - - $name_field_2->options['alter']['alter_text'] = TRUE; - $name_field_2->options['alter']['text'] = '{% if name_2|length > 3 %}{{ name_2 }} {{ name_1 }}{% endif %}'; - - foreach ($view->result as $row) { - $expected_output_0 = $row->views_test_data_name; - $expected_output_1 = "$row->views_test_data_name $row->views_test_data_name"; - $expected_output_2 = "$row->views_test_data_name $row->views_test_data_name $row->views_test_data_name"; - - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_0, $row) { - return $name_field_0->advancedRender($row); - }); - $this->assertEqual($output, $expected_output_0, format_string('Test token replacement: "!token" gave "!output"', [ - '!token' => $name_field_0->options['alter']['text'], - '!output' => $output, - ])); - - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_1, $row) { - return $name_field_1->advancedRender($row); - }); - $this->assertEqual($output, $expected_output_1, format_string('Test token replacement: "!token" gave "!output"', [ - '!token' => $name_field_1->options['alter']['text'], - '!output' => $output, - ])); - - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_2, $row) { - return $name_field_2->advancedRender($row); - }); - $this->assertEqual($output, $expected_output_2, format_string('Test token replacement: "!token" gave "!output"', [ - '!token' => $name_field_2->options['alter']['text'], - '!output' => $output, - ])); - } - - $job_field = $view->field['job']; - $job_field->options['alter']['alter_text'] = TRUE; - $job_field->options['alter']['text'] = '{{ job }}'; - - $random_text = $this->randomMachineName(); - $job_field->setTestValue($random_text); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) { - return $job_field->advancedRender($row); - }); - $this->assertSubString($output, $random_text, format_string('Make sure the self token (!token => !value) appears in the output (!output)', [ - '!value' => $random_text, - '!output' => $output, - '!token' => $job_field->options['alter']['text'], - ])); - - // Verify the token format used in D7 and earlier does not get substituted. - $old_token = '[job]'; - $job_field->options['alter']['text'] = $old_token; - $random_text = $this->randomMachineName(); - $job_field->setTestValue($random_text); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) { - return $job_field->advancedRender($row); - }); - $this->assertEqual($output, $old_token, format_string('Make sure the old token style (!token => !value) is not changed in the output (!output)', [ - '!value' => $random_text, - '!output' => $output, - '!token' => $job_field->options['alter']['text'], - ])); - - // Verify HTML tags are allowed in rewrite templates while token - // replacements are escaped. - $job_field->options['alter']['text'] = '

{{ job }}

'; - $random_text = $this->randomMachineName(); - $job_field->setTestValue('' . $random_text . ''); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) { - return $job_field->advancedRender($row); - }); - $this->assertEqual($output, '

<span>' . $random_text . '</span>

', 'Valid tags are allowed in rewrite templates and token replacements.'); - - // Verify '; - $job_field->options['alter']['text'] = $rewrite_template; - $random_text = $this->randomMachineName(); - $job_field->setTestValue($random_text); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) { - return $job_field->advancedRender($row); - }); - $this->assertNotSubString($output, ''; - $job_field->options['alter']['text'] = $rewrite_template; - $random_text = $this->randomMachineName(); - $job_field->setTestValue($random_text); - $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) { - return $job_field->advancedRender($row); - }); - $this->assertEqual($output, $random_text, format_string('Make sure a script tag in the template (!template) is removed, leaving only the replaced token in the output (!output)', [ - '!output' => $output, - '!template' => $rewrite_template, - ])); - } - - /** - * Tests the exclude setting. - */ - public function testExclude() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = $this->container->get('renderer'); - $view = Views::getView('test_field_output'); - $view->initHandlers(); - // Hide the field and see whether it's rendered. - $view->field['name']->options['exclude'] = TRUE; - - $output = $view->preview(); - $output = $renderer->renderRoot($output); - foreach ($this->dataSet() as $entry) { - $this->assertNotSubString($output, $entry['name']); - } - - // Show and check the field. - $view->field['name']->options['exclude'] = FALSE; - - $output = $view->preview(); - $output = $renderer->renderRoot($output); - foreach ($this->dataSet() as $entry) { - $this->assertSubString($output, $entry['name']); - } - } - - /** - * Tests everything related to empty output of a field. - */ - function testEmpty() { - $this->_testHideIfEmpty(); - $this->_testEmptyText(); - } - - /** - * Tests the hide if empty functionality. - * - * This tests alters the result to get easier and less coupled results. - */ - function _testHideIfEmpty() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = \Drupal::service('renderer'); - - $view = Views::getView('test_view'); - $view->initDisplay(); - $this->executeView($view); - - $column_map_reversed = array_flip($this->columnMap); - $view->row_index = 0; - $random_name = $this->randomMachineName(); - $random_value = $this->randomMachineName(); - - // Test when results are not rewritten and empty values are not hidden. - $view->field['name']->options['hide_alter_empty'] = FALSE; - $view->field['name']->options['hide_empty'] = FALSE; - $view->field['name']->options['empty_zero'] = FALSE; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'By default, a string should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'By default, "" should not be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, '0', 'By default, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'By default, "0" should not be treated as empty.'); - - // Test when results are not rewritten and non-zero empty values are hidden. - $view->field['name']->options['hide_alter_empty'] = TRUE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = FALSE; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If hide_empty is checked, a string should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If hide_empty is checked, "" should be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, '0', 'If hide_empty is checked, but not empty_zero, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If hide_empty is checked, but not empty_zero, "0" should not be treated as empty.'); - - // Test when results are not rewritten and all empty values are hidden. - $view->field['name']->options['hide_alter_empty'] = TRUE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = TRUE; - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, 0 should be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, "0" should be treated as empty.'); - - // Test when results are rewritten to a valid string and non-zero empty - // results are hidden. - $view->field['name']->options['hide_alter_empty'] = FALSE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = FALSE; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $view->field['name']->options['alter']['text'] = $random_name; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_value; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, it should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "" should not be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "0" should not be treated as empty.'); - - // Test when results are rewritten to an empty string and non-zero empty results are hidden. - $view->field['name']->options['hide_alter_empty'] = TRUE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = FALSE; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $view->field['name']->options['alter']['text'] = ""; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_name, 'If the rewritten string is empty, it should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If the rewritten string is empty, "" should be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, '0', 'If the rewritten string is empty, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If the rewritten string is empty, "0" should not be treated as empty.'); - - // Test when results are rewritten to zero as a string and non-zero empty - // results are hidden. - $view->field['name']->options['hide_alter_empty'] = FALSE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = FALSE; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $view->field['name']->options['alter']['text'] = "0"; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, the string rewritten as 0 should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, "" rewritten as 0 should not be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If the rewritten string is zero and empty_zero is not checked, "0" should not be treated as empty.'); - - // Test when results are rewritten to a valid string and non-zero empty - // results are hidden. - $view->field['name']->options['hide_alter_empty'] = TRUE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = FALSE; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $view->field['name']->options['alter']['text'] = $random_value; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, it should not be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If either the original or rewritten string is invalid, "" should be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $random_value, 'If the original and rewritten strings are valid, "0" should not be treated as empty.'); - - // Test when results are rewritten to zero as a string and all empty - // original values and results are hidden. - $view->field['name']->options['hide_alter_empty'] = TRUE; - $view->field['name']->options['hide_empty'] = TRUE; - $view->field['name']->options['empty_zero'] = TRUE; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $view->field['name']->options['alter']['text'] = "0"; - - // Test a valid string. - $view->result[0]->{$column_map_reversed['name']} = $random_name; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, it should be treated as empty.'); - - // Test an empty string. - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, "" should be treated as empty.'); - - // Test zero as an integer. - $view->result[0]->{$column_map_reversed['name']} = 0; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, 0 should not be treated as empty.'); - - // Test zero as a string. - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, "0" should not be treated as empty.'); - } - - /** - * Tests the usage of the empty text. - */ - function _testEmptyText() { - /** @var \Drupal\Core\Render\RendererInterface $renderer */ - $renderer = \Drupal::service('renderer'); - - $view = Views::getView('test_view'); - $view->initDisplay(); - $this->executeView($view); - - $column_map_reversed = array_flip($this->columnMap); - $view->row_index = 0; - - $empty_text = $view->field['name']->options['empty'] = $this->randomMachineName(); - $view->result[0]->{$column_map_reversed['name']} = ""; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $empty_text, 'If a field is empty, the empty text should be used for the output.'); - - $view->result[0]->{$column_map_reversed['name']} = "0"; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, "0", 'If a field is 0 and empty_zero is not checked, the empty text should not be used for the output.'); - - $view->result[0]->{$column_map_reversed['name']} = "0"; - $view->field['name']->options['empty_zero'] = TRUE; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $empty_text, 'If a field is 0 and empty_zero is checked, the empty text should be used for the output.'); - - $view->result[0]->{$column_map_reversed['name']} = ""; - $view->field['name']->options['alter']['alter_text'] = TRUE; - $alter_text = $view->field['name']->options['alter']['text'] = $this->randomMachineName(); - $view->field['name']->options['hide_alter_empty'] = FALSE; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $alter_text, 'If a field is empty, some rewrite text exists, but hide_alter_empty is not checked, render the rewrite text.'); - - $view->field['name']->options['hide_alter_empty'] = TRUE; - $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { - return $view->field['name']->advancedRender($view->result[0]); - }); - $this->assertIdentical($render, $empty_text, 'If a field is empty, some rewrite text exists, and hide_alter_empty is checked, use the empty text.'); - } - - /** - * Tests views_handler_field::isValueEmpty(). - */ - function testIsValueEmpty() { - $view = Views::getView('test_view'); - $view->initHandlers(); - $field = $view->field['name']; - - $this->assertFalse($field->isValueEmpty("not empty", TRUE), 'A normal string is not empty.'); - $this->assertTrue($field->isValueEmpty("not empty", TRUE, FALSE), 'A normal string which skips empty() can be seen as empty.'); - - $this->assertTrue($field->isValueEmpty("", TRUE), '"" is considered as empty.'); - - $this->assertTrue($field->isValueEmpty('0', TRUE), '"0" is considered as empty if empty_zero is TRUE.'); - $this->assertTrue($field->isValueEmpty(0, TRUE), '0 is considered as empty if empty_zero is TRUE.'); - $this->assertFalse($field->isValueEmpty('0', FALSE), '"0" is considered not as empty if empty_zero is FALSE.'); - $this->assertFalse($field->isValueEmpty(0, FALSE), '0 is considered not as empty if empty_zero is FALSE.'); - - $this->assertTrue($field->isValueEmpty(NULL, TRUE, TRUE), 'Null should be always seen as empty, regardless of no_skip_empty.'); - $this->assertTrue($field->isValueEmpty(NULL, TRUE, FALSE), 'Null should be always seen as empty, regardless of no_skip_empty.'); - } - - /** - * Tests whether the filters are click sortable as expected. - */ - public function testClickSortable() { - // Test that clickSortable is TRUE by default. - $item = array( - 'table' => 'views_test_data', - 'field' => 'name', - ); - $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); - $this->assertTrue($plugin->clickSortable(), 'TRUE as a default value is correct.'); - - // Test that clickSortable is TRUE by when set TRUE in the data. - $item['field'] = 'id'; - $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); - $this->assertTrue($plugin->clickSortable(), 'TRUE as a views data value is correct.'); - - // Test that clickSortable is FALSE by when set FALSE in the data. - $item['field'] = 'job'; - $plugin = $this->container->get('plugin.manager.views.field')->getHandler($item); - $this->assertFalse($plugin->clickSortable(), 'FALSE as a views data value is correct.'); - } - - /** - * Tests the trimText method. - */ - public function testTrimText() { - // Test unicode. See https://www.drupal.org/node/513396#comment-2839416. - $text = array( - 'Tuy nhiên, những hi vọng', - 'Giả sử chúng tôi có 3 Apple', - 'siêu nhỏ này là bộ xử lý', - 'Di động của nhà sản xuất Phần Lan', - 'khoảng cách từ đại lí đến', - 'của hãng bao gồm ba dòng', - 'сд асд асд ас', - 'асд асд асд ас' - ); - // Just test maxlength without word boundary. - $alter = array( - 'max_length' => 10, - ); - $expect = array( - 'Tuy nhiên,', - 'Giả sử chú', - 'siêu nhỏ n', - 'Di động củ', - 'khoảng các', - 'của hãng b', - 'сд асд асд', - 'асд асд ас', - ); - - foreach ($text as $key => $line) { - $result_text = FieldPluginBase::trimText($alter, $line); - $this->assertEqual($result_text, $expect[$key]); - } - - // Test also word_boundary - $alter['word_boundary'] = TRUE; - $expect = array( - 'Tuy nhiên', - 'Giả sử', - 'siêu nhỏ', - 'Di động', - 'khoảng', - 'của hãng', - 'сд асд', - 'асд асд', - ); - - foreach ($text as $key => $line) { - $result_text = FieldPluginBase::trimText($alter, $line); - $this->assertEqual($result_text, $expect[$key]); - } - } - -} diff --git a/core/modules/views/src/Tests/Plugin/DisplayUnitTest.php b/core/modules/views/src/Tests/Plugin/DisplayUnitTest.php deleted file mode 100644 index 918f3bd19..000000000 --- a/core/modules/views/src/Tests/Plugin/DisplayUnitTest.php +++ /dev/null @@ -1,122 +0,0 @@ -mergeDefaults(); - $view->save(); - - // Reload to get saved storage values. - $view = Views::getView('test_display_defaults'); - $view->initDisplay(); - $display_data = $view->storage->get('display'); - - foreach ($view->displayHandlers as $id => $display) { - // Test the view plugin options against the storage. - foreach ($this->pluginTypes as $type) { - $options = $display->getOption($type); - $this->assertIdentical($display_data[$id]['display_options'][$type]['options'], $options['options']); - } - // Test the view handler options against the storage. - foreach ($this->handlerTypes as $type) { - $options = $display->getOption($type); - $this->assertIdentical($display_data[$id]['display_options'][$type], $options); - } - } - } - - /** - * Tests the \Drupal\views\Plugin\views\display\DisplayPluginBase::getPlugin() method. - */ - public function testGetPlugin() { - $view = Views::getView('test_display_defaults'); - $view->initDisplay(); - $display_handler = $view->display_handler; - - $this->assertTrue($display_handler->getPlugin('access') instanceof AccessPluginBase, 'An access plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('cache') instanceof CachePluginBase, 'A cache plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('exposed_form') instanceof ExposedFormPluginBase, 'An exposed_form plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('pager') instanceof PagerPluginBase, 'A pager plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('query') instanceof QueryPluginBase, 'A query plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('row') instanceof RowPluginBase, 'A row plugin instance was returned.'); - $this->assertTrue($display_handler->getPlugin('style') instanceof StylePluginBase, 'A style plugin instance was returned.'); - // Test that nothing is returned when an invalid type is requested. - $this->assertNull($display_handler->getPlugin('invalid'), 'NULL was returned for an invalid instance'); - // Test that nothing was returned for an instance with no 'type' in options. - unset($display_handler->options['access']); - $this->assertNull($display_handler->getPlugin('access'), 'NULL was returned for a plugin type with no "type" option'); - - // Get a plugin twice, and make sure the same instance is returned. - $view->destroy(); - $view->initDisplay(); - $first = spl_object_hash($display_handler->getPlugin('style')); - $second = spl_object_hash($display_handler->getPlugin('style')); - $this->assertIdentical($first, $second, 'The same plugin instance was returned.'); - } - -} diff --git a/core/modules/views/src/Tests/Plugin/PluginUnitTestBase.php b/core/modules/views/src/Tests/Plugin/PluginUnitTestBase.php deleted file mode 100644 index 96ebcda4b..000000000 --- a/core/modules/views/src/Tests/Plugin/PluginUnitTestBase.php +++ /dev/null @@ -1,17 +0,0 @@ -installSchema('system', array('router', 'sequences')); - $this->setUpFixtures(); - - if ($import_test_views) { - ViewTestData::createTestViews(get_class($this), array('views_test_config')); - } - } - - /** - * Sets up the configuration and schema of views and views_test_data modules. - * - * Because the schema of views_test_data.module is dependent on the test - * using it, it cannot be enabled normally. - */ - protected function setUpFixtures() { - // First install the system module. Many Views have Page displays have menu - // links, and for those to work, the system menus must already be present. - $this->installConfig(array('system')); - - // Define the schema and views data variable before enabling the test module. - \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition()); - \Drupal::state()->set('views_test_data_views_data', $this->viewsData()); - - $this->installConfig(array('views', 'views_test_config', 'views_test_data')); - foreach ($this->schemaDefinition() as $table => $schema) { - $this->installSchema('views_test_data', $table); - } - - \Drupal::service('router.builder')->rebuild(); - - // Load the test dataset. - $data_set = $this->dataSet(); - $query = db_insert('views_test_data') - ->fields(array_keys($data_set[0])); - foreach ($data_set as $record) { - $query->values($record); - } - $query->execute(); - } - - /** - * Orders a nested array containing a result set based on a given column. - * - * @param array $result_set - * An array of rows from a result set, with each row as an associative - * array keyed by column name. - * @param string $column - * The column name by which to sort the result set. - * @param bool $reverse - * (optional) Boolean indicating whether to sort the result set in reverse - * order. Defaults to FALSE. - * - * @return array - * The sorted result set. - */ - protected function orderResultSet($result_set, $column, $reverse = FALSE) { - $order = $reverse ? -1 : 1; - usort($result_set, function ($a, $b) use ($column, $order) { - if ($a[$column] == $b[$column]) { - return 0; - } - return $order * (($a[$column] < $b[$column]) ? -1 : 1); - }); - return $result_set; - } - - /** - * Executes a view with debugging. - * - * @param \Drupal\views\ViewExecutable $view - * The view object. - * @param array $args - * (optional) An array of the view arguments to use for the view. - */ - protected function executeView($view, array $args = array()) { - $view->setDisplay(); - $view->preExecute($args); - $view->execute(); - $verbose_message = '
Executed view: ' . ((string) $view->build_info['query']). '
'; - if ($view->build_info['query'] instanceof SelectInterface) { - $verbose_message .= '
Arguments: ' . print_r($view->build_info['query']->getArguments(), TRUE) . '
'; - } - $this->verbose($verbose_message); - } - - /** - * Returns the schema definition. - */ - protected function schemaDefinition() { - return ViewTestData::schemaDefinition(); - } - - /** - * Returns the views data definition. - */ - protected function viewsData() { - return ViewTestData::viewsData(); - } - - /** - * Returns a very simple test dataset. - */ - protected function dataSet() { - return ViewTestData::dataSet(); - } - -} diff --git a/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php deleted file mode 100644 index fbd6682de..000000000 --- a/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php +++ /dev/null @@ -1,79 +0,0 @@ -installConfig(array('language')); - - $this->wizard = $this->container->get('plugin.manager.views.wizard')->createInstance('standard:views_test_data', array()); - } - - /** - * Tests the creating of a view. - * - * @see \Drupal\views\Plugin\views\wizard\WizardPluginBase - */ - public function testCreateView() { - $form = array(); - $form_state = new FormState(); - $form = $this->wizard->buildForm($form, $form_state); - $random_id = strtolower($this->randomMachineName()); - $random_label = $this->randomMachineName(); - $random_description = $this->randomMachineName(); - - // Add a new language and mark it as default. - ConfigurableLanguage::createFromLangcode('it')->save(); - $this->config('system.site')->set('default_langcode', 'it')->save(); - - $form_state->setValues([ - 'id' => $random_id, - 'label' => $random_label, - 'description' => $random_description, - 'base_table' => 'views_test_data', - ]); - - $this->wizard->validateView($form, $form_state); - $view = $this->wizard->createView($form, $form_state); - $this->assertTrue($view instanceof ViewUI, 'The created view is a ViewUI object.'); - $this->assertEqual($view->get('id'), $random_id); - $this->assertEqual($view->get('label'), $random_label); - $this->assertEqual($view->get('description'), $random_description); - $this->assertEqual($view->get('base_table'), 'views_test_data'); - $this->assertEqual($view->get('langcode'), 'it'); - } -} - diff --git a/core/tests/Drupal/Tests/Core/ContentNegotiationTest.php b/core/tests/Drupal/Tests/Core/ContentNegotiationTest.php deleted file mode 100644 index b5f9d3f72..000000000 --- a/core/tests/Drupal/Tests/Core/ContentNegotiationTest.php +++ /dev/null @@ -1,79 +0,0 @@ -contentNegotiation = new ContentNegotiation; - } - - /** - * Tests the getContentType() method with AJAX iframe upload. - * - * @covers ::getContentType - */ - public function testAjaxIframeUpload() { - $request = new Request(); - $request->attributes->set('ajax_iframe_upload', '1'); - - $this->assertSame('iframeupload', $this->contentNegotiation->getContentType($request)); - } - - /** - * Tests the specifying a format via query parameters gets used. - */ - public function testFormatViaQueryParameter() { - $request = new Request(); - $request->query->set('_format', 'bob'); - - $this->assertSame('bob', $this->contentNegotiation->getContentType($request)); - } - - /** - * Tests the getContentType() method when no priority format is found. - * - * @covers ::getContentType - */ - public function testUnknowContentTypeReturnsHtmlByDefault() { - $request = new Request(); - - $this->assertSame('html', $this->contentNegotiation->getContentType($request)); - } - - /** - * Tests the getContentType() method when no priority format is found but it's an AJAX request. - * - * @covers ::getContentType - */ - public function testUnknowContentTypeButAjaxRequest() { - $request = new Request(); - $request->headers->set('X-Requested-With', 'XMLHttpRequest'); - - $this->assertSame('html', $this->contentNegotiation->getContentType($request)); - } - -} diff --git a/core/themes/bartik/css/components/admin.css b/core/themes/bartik/css/components/admin.css deleted file mode 100644 index b9803ceb7..000000000 --- a/core/themes/bartik/css/components/admin.css +++ /dev/null @@ -1,34 +0,0 @@ -/* ---------- Admin-specific Theming ---------- */ -.path-admin #content img { - margin-right: 15px; /* LTR */ -} -[dir="rtl"] .path-admin #content img { - margin-left: 15px; - margin-right: 0; -} -.path-admin #content .simpletest-image img { - margin: 0; -} -.path-admin #admin-dblog img { - margin: 0 5px; -} - -/* Block demo mode */ -.demo-block { - background: #ffff66; - border: 1px dotted #9f9e00; - color: #000; - font: 90% "Lucida Grande", "Lucida Sans Unicode", sans-serif; - margin: 5px; - padding: 5px; - text-align: center; - text-shadow: none; -} -.featured-top .demo-block { - font-size: 0.55em; -} -#header .demo-block { - width: 500px; -} - - diff --git a/core/themes/bartik/css/components/content.css b/core/themes/bartik/css/components/content.css deleted file mode 100644 index cf436e857..000000000 --- a/core/themes/bartik/css/components/content.css +++ /dev/null @@ -1,241 +0,0 @@ -/* ----------------- Content ------------------ */ - -.content, -.node__content { - margin-top: 10px; -} -h1#page-title { - font-size: 2em; - line-height: 1; -} -.main-content .section { - padding: 0 15px; -} -@media all and (min-width: 851px) { - .main-content { - float: left; /* LTR */ - position: relative; - } - [dir="rtl"] .main-content { - float: right; - } - .layout-two-sidebars .main-content { - margin-left: 25%; - margin-right: 25%; - width: 50%; - } - .layout-one-sidebar .main-content { - width: 75%; - } - .layout-no-sidebars .main-content { - width: 100%; - } - .layout-sidebar-first .main-content { - margin-left: 25%; /* LTR */ - margin-right: 0; /* LTR */ - } - [dir="rtl"] .layout-sidebar-first .main-content { - margin-left: 0; - margin-right: 25%; - } - .layout-sidebar-second .main-content { - margin-right: 25%; /* LTR */ - margin-left: 0; /* LTR */ - } - [dir="rtl"] .layout-sidebar-second .main-content { - margin-right: 0; - margin-left: 25%; - } -} - -#content h2 { - margin-bottom: 2px; - font-size: 1.429em; - line-height: 1.4; -} -.node__content { - font-size: 1.071em; -} -.node--view-mode-teaser .node__content { - font-size: 1em; -} -.node--view-mode-teaser h2 { - margin-top: 0; - padding-top: 0.5em; -} -.node--view-mode-teaser h2 a { - color: #181818; -} -.node--view-mode-teaser { - border-bottom: 1px solid #d3d7d9; - margin-bottom: 30px; - padding-bottom: 15px; -} -.node--view-mode-teaser.node--sticky { - background: #f9f9f9; - background: rgba(0, 0, 0, 0.024); - border: 1px solid #d3d7d9; - padding: 0 15px 15px; -} -.node--view-mode-teaser .node__content { - clear: none; - line-height: 1.6; -} -.node__meta { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 0.857em; - color: #68696b; - margin-bottom: -5px; -} -.node__meta .field-name-field-user-picture img { - float: left; /* LTR */ - margin: 1px 20px 0 0; /* LTR */ -} -[dir="rtl"] .node__meta .field-name-field-user-picture img { - float: right; - margin-left: 20px; - margin-right: 0; -} -.field-name-field-tags { - margin: 0 0 1.2em; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} -.field-name-field-tags .field-label { - font-weight: normal; - margin: 0; - padding-right: 5px; /* LTR */ -} -[dir="rtl"] .field-name-field-tags .field-label { - padding-left: 5px; - padding-right: 0; -} -.field-name-field-tags .field-label, -.field-name-field-tags ul.links { - font-size: 0.8em; -} -.node--view-mode-teaser .field-name-field-tags .field-label, -.node--view-mode-teaser .field-name-field-tags ul.links { - font-size: 0.821em; -} -.field-name-field-tags ul.links { - padding: 0; - margin: 0; - list-style: none; -} -.field-name-field-tags ul.links li { - float: left; /* LTR */ - padding: 0 1em 0 0; /* LTR */ - white-space: nowrap; -} -[dir="rtl"] .field-name-field-tags ul.links li { - padding: 0 0 0 1em; - float: right; -} -.node__links { - text-align: right; /* LTR */ -} -[dir="rtl"] .node__links { - text-align: left; -} -@media all and (min-width: 560px) { - .node .field-type-image { - float: left; /* LTR */ - margin: 0 1em 0 0; /* LTR */ - } - [dir="rtl"] .node .field-type-image { - float: right; - margin: 0 0 0 1em; - } - .node .field-type-image + .field-type-image { - clear: both; - } -} -.field-type-image img, -.field-name-field-user-picture img { - margin: 0 0 1em; -} -.field-type-image a { - border-bottom: none; -} -ul.links { - color: #68696b; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 0.821em; -} -.node--unpublished, -.unpublished { - padding: 20px 15px 0; -} -.node-preview-container { - background: #d1e8f5; - background-image: -webkit-linear-gradient(top, #d1e8f5, #d3e8f4); - background-image: linear-gradient(to bottom, #d1e8f5, #d3e8f4); - font-family: Arial, sans-serif; - box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.3333); - position: fixed; - z-index: 499; - width: 100%; - padding: 10px; -} -.node-preview-backlink { - background-color: #419ff1; - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, -webkit-linear-gradient(top, #419ff1, #1076d5); - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, linear-gradient(to bottom, #419ff1, #1076d5); /* LTR */ - border: 1px solid #0048c8; - border-radius: .4em; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); - color: #fff; - font-size: 0.9em; - line-height: normal; - margin: 0; - padding: 4px 1em 4px 0.6em; /* LTR */ - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); -} -[dir="rtl"] .node-preview-backlink { - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, -webkit-linear-gradient(top, #419ff1, #1076d5); - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, linear-gradient(to bottom, #419ff1, #1076d5); - padding: 4px 0.6em 4px 1em; - float: right; -} -.node-preview-backlink:focus, -.node-preview-backlink:hover { - background-color: #419cf1; - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, -webkit-linear-gradient(top, #59abf3, #2a90ef); - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, linear-gradient(to bottom, #59abf3, #2a90ef); /* LTR */ - border: 1px solid #0048c8; - text-decoration: none; - color: #fff; -} -[dir="rtl"] .node-preview-backlink:focus, -[dir="rtl"] .node-preview-backlink:hover { - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, -webkit-linear-gradient(top, #59abf3, #2a90ef); - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, linear-gradient(to bottom, #59abf3, #2a90ef); -} -.node-preview-backlink:active { - background-color: #0e69be; - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, -webkit-linear-gradient(top, #0e69be, #2a93ef); - background: url(../../../../misc/icons/000000/chevron-left.svg) left no-repeat, linear-gradient(to bottom, #0e69be, #2a93ef); /* LTR */ - border: 1px solid #0048c8; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); -} -.node-preview-backlink:active { - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, -webkit-linear-gradient(top, #0e69be, #2a93ef); - background: url(../../../../misc/icons/000000/chevron-right.svg) right no-repeat, linear-gradient(to bottom, #0e69be, #2a93ef); -} -.node-preview-backlink::before { - content: ''; - width: 10px; - display: inline-block; -} -.region-content ul, -.region-content ol { - margin: 1em 0; - padding: 0 0 0.25em 15px; /* LTR */ -} -[dir="rtl"] .region-content ul, -[dir="rtl"] .region-content ol { - padding: 0 15px 0.25em 0; -} -#page .ui-widget { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} diff --git a/core/themes/bartik/css/components/region-help.css b/core/themes/bartik/css/components/region-help.css deleted file mode 100644 index 3c16b0d73..000000000 --- a/core/themes/bartik/css/components/region-help.css +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @file - * Styles for the help region. - */ - -.region-help { - border: 1px solid #d3d7d9; - padding: 0 1.5em; - margin-bottom: 30px; -} diff --git a/core/themes/bartik/css/components/tips.css b/core/themes/bartik/css/components/tips.css deleted file mode 100644 index 6d350fafa..000000000 --- a/core/themes/bartik/css/components/tips.css +++ /dev/null @@ -1,7 +0,0 @@ -/* ----------------- Tips ----------------- */ -ul.tips { - padding: 0 0 0 1.25em; /* LTR */ -} -[dir="rtl"] ul.tips { - padding: 0 1.25em 0 0; -} diff --git a/core/themes/bartik/css/components/user.css b/core/themes/bartik/css/components/user.css deleted file mode 100644 index 3963534d5..000000000 --- a/core/themes/bartik/css/components/user.css +++ /dev/null @@ -1,8 +0,0 @@ -/* -------------- User Profile -------------- */ - -.profile .field-name-field-user-picture { - float: none; -} -div.password-suggestions { - border: 0; -}