Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\text\Kernel\Migrate;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@ class TextFormatterTest extends EntityKernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('text');
|
||||
public static $modules = ['text'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -41,23 +41,23 @@ class TextFormatterTest extends EntityKernelTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
FilterFormat::create(array(
|
||||
FilterFormat::create([
|
||||
'format' => 'my_text_format',
|
||||
'name' => 'My text format',
|
||||
'filters' => array(
|
||||
'filter_autop' => array(
|
||||
'filters' => [
|
||||
'filter_autop' => [
|
||||
'module' => 'filter',
|
||||
'status' => TRUE,
|
||||
),
|
||||
),
|
||||
))->save();
|
||||
],
|
||||
],
|
||||
])->save();
|
||||
|
||||
FieldStorageConfig::create(array(
|
||||
FieldStorageConfig::create([
|
||||
'field_name' => 'formatted_text',
|
||||
'entity_type' => $this->entityType,
|
||||
'type' => 'text',
|
||||
'settings' => array(),
|
||||
))->save();
|
||||
'settings' => [],
|
||||
])->save();
|
||||
FieldConfig::create([
|
||||
'entity_type' => $this->entityType,
|
||||
'bundle' => $this->bundle,
|
||||
|
@ -70,28 +70,28 @@ class TextFormatterTest extends EntityKernelTestBase {
|
|||
* Tests all text field formatters.
|
||||
*/
|
||||
public function testFormatters() {
|
||||
$formatters = array(
|
||||
$formatters = [
|
||||
'text_default',
|
||||
'text_trimmed',
|
||||
'text_summary_or_trimmed',
|
||||
);
|
||||
];
|
||||
|
||||
// Create the entity to be referenced.
|
||||
$entity = $this->container->get('entity_type.manager')
|
||||
->getStorage($this->entityType)
|
||||
->create(array('name' => $this->randomMachineName()));
|
||||
$entity->formatted_text = array(
|
||||
->create(['name' => $this->randomMachineName()]);
|
||||
$entity->formatted_text = [
|
||||
'value' => 'Hello, world!',
|
||||
'format' => 'my_text_format',
|
||||
);
|
||||
];
|
||||
$entity->save();
|
||||
|
||||
foreach ($formatters as $formatter) {
|
||||
// Verify the text field formatter's render array.
|
||||
$build = $entity->get('formatted_text')->view(array('type' => $formatter));
|
||||
$build = $entity->get('formatted_text')->view(['type' => $formatter]);
|
||||
\Drupal::service('renderer')->renderRoot($build[0]);
|
||||
$this->assertEqual($build[0]['#markup'], "<p>Hello, world!</p>\n");
|
||||
$this->assertEqual($build[0]['#cache']['tags'], FilterFormat::load('my_text_format')->getCacheTags(), format_string('The @formatter formatter has the expected cache tags when formatting a formatted text field.', array('@formatter' => $formatter)));
|
||||
$this->assertEqual($build[0]['#cache']['tags'], FilterFormat::load('my_text_format')->getCacheTags(), format_string('The @formatter formatter has the expected cache tags when formatting a formatted text field.', ['@formatter' => $formatter]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ use Drupal\filter\Entity\FilterFormat;
|
|||
*/
|
||||
class TextSummaryTest extends KernelTestBase {
|
||||
|
||||
public static $modules = array('system', 'user', 'filter', 'text');
|
||||
public static $modules = ['system', 'user', 'filter', 'text'];
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(array('text'));
|
||||
$this->installConfig(['text']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ class TextSummaryTest extends KernelTestBase {
|
|||
* subsequent sentences are not. This edge case is documented at
|
||||
* https://www.drupal.org/node/180425.
|
||||
*/
|
||||
function testFirstSentenceQuestion() {
|
||||
public function testFirstSentenceQuestion() {
|
||||
$text = 'A question? A sentence. Another sentence.';
|
||||
$expected = 'A question? A sentence.';
|
||||
$this->assertTextSummary($text, $expected, NULL, 30);
|
||||
|
@ -34,7 +34,7 @@ class TextSummaryTest extends KernelTestBase {
|
|||
/**
|
||||
* Test summary with long example.
|
||||
*/
|
||||
function testLongSentence() {
|
||||
public function testLongSentence() {
|
||||
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' . // 125
|
||||
'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ' . // 108
|
||||
'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' . // 103
|
||||
|
@ -49,26 +49,26 @@ class TextSummaryTest extends KernelTestBase {
|
|||
/**
|
||||
* Test various summary length edge cases.
|
||||
*/
|
||||
function testLength() {
|
||||
FilterFormat::create(array(
|
||||
public function testLength() {
|
||||
FilterFormat::create([
|
||||
'format' => 'autop',
|
||||
'filters' => array(
|
||||
'filter_autop' => array(
|
||||
'filters' => [
|
||||
'filter_autop' => [
|
||||
'status' => 1,
|
||||
),
|
||||
),
|
||||
))->save();
|
||||
FilterFormat::create(array(
|
||||
],
|
||||
],
|
||||
])->save();
|
||||
FilterFormat::create([
|
||||
'format' => 'autop_correct',
|
||||
'filters' => array(
|
||||
'filter_autop' => array(
|
||||
'filters' => [
|
||||
'filter_autop' => [
|
||||
'status' => 1,
|
||||
),
|
||||
'filter_htmlcorrector' => array(
|
||||
],
|
||||
'filter_htmlcorrector' => [
|
||||
'status' => 1,
|
||||
),
|
||||
),
|
||||
))->save();
|
||||
],
|
||||
],
|
||||
])->save();
|
||||
|
||||
// This string tests a number of edge cases.
|
||||
$text = "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>";
|
||||
|
@ -205,12 +205,12 @@ class TextSummaryTest extends KernelTestBase {
|
|||
/**
|
||||
* Calls text_summary() and asserts that the expected teaser is returned.
|
||||
*/
|
||||
function assertTextSummary($text, $expected, $format = NULL, $size = NULL) {
|
||||
public function assertTextSummary($text, $expected, $format = NULL, $size = NULL) {
|
||||
$summary = text_summary($text, $format, $size);
|
||||
$this->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', array(
|
||||
$this->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', [
|
||||
'@actual' => $summary,
|
||||
'@expected' => $expected,
|
||||
)));
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class TextWithSummaryItemTest extends FieldKernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('filter');
|
||||
public static $modules = ['filter'];
|
||||
|
||||
/**
|
||||
* Field storage entity.
|
||||
|
@ -44,11 +44,11 @@ class TextWithSummaryItemTest extends FieldKernelTestBase {
|
|||
$this->installEntitySchema('entity_test_rev');
|
||||
|
||||
// Create the necessary formats.
|
||||
$this->installConfig(array('filter'));
|
||||
FilterFormat::create(array(
|
||||
$this->installConfig(['filter']);
|
||||
FilterFormat::create([
|
||||
'format' => 'no_filters',
|
||||
'filters' => array(),
|
||||
))->save();
|
||||
'filters' => [],
|
||||
])->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,14 +100,14 @@ class TextWithSummaryItemTest extends FieldKernelTestBase {
|
|||
*/
|
||||
protected function createField($entity_type) {
|
||||
// Create a field .
|
||||
$this->fieldStorage = FieldStorageConfig::create(array(
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => 'summary_field',
|
||||
'entity_type' => $entity_type,
|
||||
'type' => 'text_with_summary',
|
||||
'settings' => array(
|
||||
'settings' => [
|
||||
'max_length' => 10,
|
||||
)
|
||||
));
|
||||
]
|
||||
]);
|
||||
$this->fieldStorage->save();
|
||||
$this->field = FieldConfig::create([
|
||||
'field_storage' => $this->fieldStorage,
|
||||
|
|
|
@ -71,12 +71,12 @@ class TextFieldTest extends UnitTestCase {
|
|||
* @covers ::processCckFieldValues
|
||||
*/
|
||||
public function testProcessBooleanTextImplicitValues() {
|
||||
$info = array(
|
||||
$info = [
|
||||
'widget_type' => 'optionwidgets_onoff',
|
||||
'global_settings' => array(
|
||||
'global_settings' => [
|
||||
'allowed_values' => "foo\nbar",
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
$this->plugin->processCckFieldValues($this->migration, 'field', $info);
|
||||
|
||||
$expected = [
|
||||
|
@ -96,12 +96,12 @@ class TextFieldTest extends UnitTestCase {
|
|||
* @covers ::processCckFieldValues
|
||||
*/
|
||||
public function testProcessBooleanTextExplicitValues() {
|
||||
$info = array(
|
||||
$info = [
|
||||
'widget_type' => 'optionwidgets_onoff',
|
||||
'global_settings' => array(
|
||||
'global_settings' => [
|
||||
'allowed_values' => "foo|Foo\nbaz|Baz",
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
$this->plugin->processCckFieldValues($this->migration, 'field', $info);
|
||||
|
||||
$expected = [
|
||||
|
@ -121,43 +121,43 @@ class TextFieldTest extends UnitTestCase {
|
|||
* Data provider for testGetFieldType().
|
||||
*/
|
||||
public function getFieldTypeProvider() {
|
||||
return array(
|
||||
array('string_long', 'text_textfield', array(
|
||||
return [
|
||||
['string_long', 'text_textfield', [
|
||||
'text_processing' => FALSE,
|
||||
)),
|
||||
array('string', 'text_textfield', array(
|
||||
]],
|
||||
['string', 'text_textfield', [
|
||||
'text_processing' => FALSE,
|
||||
'max_length' => 128,
|
||||
)),
|
||||
array('string_long', 'text_textfield', array(
|
||||
]],
|
||||
['string_long', 'text_textfield', [
|
||||
'text_processing' => FALSE,
|
||||
'max_length' => 4096,
|
||||
)),
|
||||
array('text_long', 'text_textfield', array(
|
||||
]],
|
||||
['text_long', 'text_textfield', [
|
||||
'text_processing' => TRUE,
|
||||
)),
|
||||
array('text', 'text_textfield', array(
|
||||
]],
|
||||
['text', 'text_textfield', [
|
||||
'text_processing' => TRUE,
|
||||
'max_length' => 128,
|
||||
)),
|
||||
array('text_long', 'text_textfield', array(
|
||||
]],
|
||||
['text_long', 'text_textfield', [
|
||||
'text_processing' => TRUE,
|
||||
'max_length' => 4096,
|
||||
)),
|
||||
array('list_string', 'optionwidgets_buttons'),
|
||||
array('list_string', 'optionwidgets_select'),
|
||||
array('boolean', 'optionwidgets_onoff'),
|
||||
array('text_long', 'text_textarea'),
|
||||
array(NULL, 'undefined'),
|
||||
);
|
||||
]],
|
||||
['list_string', 'optionwidgets_buttons'],
|
||||
['list_string', 'optionwidgets_select'],
|
||||
['boolean', 'optionwidgets_onoff'],
|
||||
['text_long', 'text_textarea'],
|
||||
[NULL, 'undefined'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getFieldType
|
||||
* @dataProvider getFieldTypeProvider
|
||||
*/
|
||||
public function testGetFieldType($expected_type, $widget_type, array $settings = array()) {
|
||||
$row = new Row(array('widget_type' => $widget_type), array('widget_type' => array()));
|
||||
public function testGetFieldType($expected_type, $widget_type, array $settings = []) {
|
||||
$row = new Row(['widget_type' => $widget_type], ['widget_type' => []]);
|
||||
$row->setSourceProperty('global_settings', $settings);
|
||||
$this->assertSame($expected_type, $this->plugin->getFieldType($row));
|
||||
}
|
||||
|
|
Reference in a new issue