updated core to 8.6.1 via composer
This commit is contained in:
@@ -4,5 +4,5 @@ type: module
|
||||
core: 8.x
|
||||
hidden: true
|
||||
dependencies:
|
||||
- link
|
||||
- entity_test
|
||||
- drupal:link
|
||||
- drupal:entity_test
|
||||
|
||||
@@ -5,6 +5,6 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- node
|
||||
- views
|
||||
- link
|
||||
- drupal:node
|
||||
- drupal:views
|
||||
- drupal:link
|
||||
|
||||
@@ -59,7 +59,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
* Tests link field URL validation.
|
||||
*/
|
||||
public function testURLValidation() {
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
// Create a field with settings to validate.
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
@@ -121,6 +121,10 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
'/?example=llama' => '<front>?example=llama',
|
||||
'/#example' => '<front>#example',
|
||||
|
||||
// Trailing spaces should be ignored.
|
||||
'/ ' => '<front>',
|
||||
'/path with spaces ' => '/path with spaces',
|
||||
|
||||
// @todo '<front>' is valid input for BC reasons, may be removed by
|
||||
// https://www.drupal.org/node/2421941
|
||||
'<front>' => '<front>',
|
||||
@@ -200,7 +204,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
|
||||
$this->assertRaw($string);
|
||||
$this->assertRaw('"' . $string . '"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +230,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
* Tests the link title settings of a link field.
|
||||
*/
|
||||
public function testLinkTitle() {
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
// Create a field with settings to validate.
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
@@ -281,6 +285,14 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
$this->assertRaw('placeholder="Enter the text for this link"');
|
||||
|
||||
$this->assertFieldByName("{$field_name}[0][title]", '', 'Link text field found.');
|
||||
if ($title_setting === DRUPAL_OPTIONAL) {
|
||||
// Verify that the URL is required, if the link text is non-empty.
|
||||
$edit = [
|
||||
"{$field_name}[0][title]" => 'Example',
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertText(t('The URL field is required when the @title field is specified.', ['@title' => t('Link text')]));
|
||||
}
|
||||
if ($title_setting === DRUPAL_REQUIRED) {
|
||||
// Verify that the link text is required, if the URL is non-empty.
|
||||
$edit = [
|
||||
@@ -340,7 +352,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
* Tests the default 'link' formatter.
|
||||
*/
|
||||
public function testLinkFormatter() {
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
// Create a field with settings to validate.
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
@@ -495,7 +507,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
* merged, since they involve different configuration and output.
|
||||
*/
|
||||
public function testLinkSeparateFormatter() {
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
// Create a field with settings to validate.
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
@@ -622,7 +634,7 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
public function testLinkTypeOnLinkWidget() {
|
||||
|
||||
$link_type = LinkItemInterface::LINK_EXTERNAL;
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
|
||||
// Create a field with settings to validate.
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
@@ -654,7 +666,6 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
$this->assertEqual($form[$field_name]['widget'][0]['uri']['#link_type'], $link_type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests editing a link to a non-node entity.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\link\Kernel;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\link\LinkItemInterface;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests link field serialization.
|
||||
*
|
||||
* @group link
|
||||
*/
|
||||
class LinkItemSerializationTest extends FieldKernelTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['link', 'serialization'];
|
||||
|
||||
/**
|
||||
* The serializer service.
|
||||
*
|
||||
* @var \Symfony\Component\Serializer\SerializerInterface
|
||||
*/
|
||||
protected $serializer;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('user');
|
||||
$this->serializer = \Drupal::service('serializer');
|
||||
|
||||
// Create a generic, external, and internal link fields for validation.
|
||||
FieldStorageConfig::create([
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'field_test',
|
||||
'type' => 'link',
|
||||
])->save();
|
||||
|
||||
FieldConfig::create([
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'field_test',
|
||||
'bundle' => 'entity_test',
|
||||
'settings' => ['link_type' => LinkItemInterface::LINK_GENERIC],
|
||||
])->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the serialization.
|
||||
*/
|
||||
public function testLinkSerialization() {
|
||||
// Create entity.
|
||||
$entity = EntityTest::create();
|
||||
$url = 'https://www.drupal.org?test_param=test_value';
|
||||
$parsed_url = UrlHelper::parse($url);
|
||||
$title = $this->randomMachineName();
|
||||
$class = $this->randomMachineName();
|
||||
$entity->field_test->uri = $parsed_url['path'];
|
||||
$entity->field_test->title = $title;
|
||||
$entity->field_test->first()
|
||||
->get('options')
|
||||
->set('query', $parsed_url['query']);
|
||||
$entity->field_test->first()
|
||||
->get('options')
|
||||
->set('attributes', ['class' => $class]);
|
||||
$entity->save();
|
||||
$serialized = $this->serializer->serialize($entity, 'json');
|
||||
$deserialized = $this->serializer->deserialize($serialized, EntityTest::class, 'json');
|
||||
$options_expected = [
|
||||
'query' => $parsed_url['query'],
|
||||
'attributes' => ['class' => $class],
|
||||
];
|
||||
$this->assertSame($options_expected, $deserialized->field_test->options);
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\link\Kernel\Plugin\migrate\cckfield\d7;
|
||||
|
||||
/**
|
||||
* @group link
|
||||
* @group legacy
|
||||
*/
|
||||
class LinkCckDeprecationTest extends LinkCckTest {
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldInstanceMigration() instead. See https://www.drupal.org/node/2944598.
|
||||
*/
|
||||
public function testAlterFieldInstanceMigration($method = 'processFieldInstance') {
|
||||
parent::testAlterFieldInstanceMigration($method);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class LinkCckTest extends KernelTestBase {
|
||||
|
||||
$migration = $this->prophesize(MigrationInterface::class);
|
||||
|
||||
// The plugin's processFieldInstance() method will call
|
||||
// The plugin's alterFieldInstanceMigration() method will call
|
||||
// mergeProcessOfProperty() and return nothing. So, in order to examine the
|
||||
// process pipeline created by the plugin, we need to ensure that
|
||||
// getProcess() always returns the last input to mergeProcessOfProperty().
|
||||
@@ -52,12 +52,10 @@ class LinkCckTest extends KernelTestBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::processCckFieldValues
|
||||
* @expectedDeprecation CckFieldPluginBase is deprecated in Drupal 8.3.x and will be be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase instead.
|
||||
* @expectedDeprecation MigrateCckFieldInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField instead.
|
||||
* @covers ::alterFieldInstanceMigration
|
||||
*/
|
||||
public function testProcessCckFieldValues() {
|
||||
$this->plugin->processFieldInstance($this->migration);
|
||||
public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
|
||||
$this->plugin->$method($this->migration);
|
||||
|
||||
$expected = [
|
||||
'plugin' => 'static_map',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\link\Kernel\Plugin\migrate\field\d7;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @group link
|
||||
*/
|
||||
class LinkFieldLegacyTest extends LinkFieldTest {
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldInstanceMigration() instead. See https://www.drupal.org/node/2944598.
|
||||
*/
|
||||
public function testAlterFieldInstanceMigration($method = 'processFieldInstance') {
|
||||
parent::testAlterFieldInstanceMigration($method);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class LinkFieldTest extends KernelTestBase {
|
||||
|
||||
$migration = $this->prophesize(MigrationInterface::class);
|
||||
|
||||
// The plugin's ProcessFieldInstance() method will call
|
||||
// The plugin's alterFieldInstanceMigration() method will call
|
||||
// mergeProcessOfProperty() and return nothing. So, in order to examine the
|
||||
// process pipeline created by the plugin, we need to ensure that
|
||||
// getProcess() always returns the last input to mergeProcessOfProperty().
|
||||
@@ -51,10 +51,10 @@ class LinkFieldTest extends KernelTestBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::processFieldInstance
|
||||
* @covers ::alterFieldInstanceMigration
|
||||
*/
|
||||
public function testProcessFieldInstance() {
|
||||
$this->plugin->processFieldInstance($this->migration);
|
||||
public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
|
||||
$this->plugin->$method($this->migration);
|
||||
|
||||
$expected = [
|
||||
'plugin' => 'static_map',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\link\Unit\Plugin\migrate\field\d6;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @group link
|
||||
*/
|
||||
class LinkFieldLegacyTest extends LinkFieldTest {
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.
|
||||
*/
|
||||
public function testDefineValueProcessPipeline($method = 'processFieldValues') {
|
||||
parent::testDefineValueProcessPipeline($method);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class LinkFieldTest extends UnitTestCase {
|
||||
|
||||
$migration = $this->prophesize(MigrationInterface::class);
|
||||
|
||||
// The plugin's processFieldValues() method will call
|
||||
// The plugin's defineValueProcessPipeline() method will call
|
||||
// mergeProcessOfProperty() and return nothing. So, in order to examine the
|
||||
// process pipeline created by the plugin, we need to ensure that
|
||||
// getProcess() always returns the last input to mergeProcessOfProperty().
|
||||
@@ -44,10 +44,10 @@ class LinkFieldTest extends UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::processFieldValues
|
||||
* @covers ::defineValueProcessPipeline
|
||||
*/
|
||||
public function testProcessFieldValues() {
|
||||
$this->plugin->processFieldValues($this->migration, 'somefieldname', []);
|
||||
public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
|
||||
$this->plugin->$method($this->migration, 'somefieldname', []);
|
||||
|
||||
$expected = [
|
||||
'plugin' => 'field_link',
|
||||
|
||||
Reference in New Issue
Block a user