diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php index 21305d0..e8109e8 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php @@ -17,7 +17,7 @@ * * @FieldType( * id = "string", - * label = @Translation("Plain text"), + * label = @Translation("Text (plain)"), * description = @Translation("A field containing a plain string value."), * default_widget = "string", * default_formatter = "string" diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringLongItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringLongItem.php index b3581fb..30a9df0 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringLongItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringLongItem.php @@ -14,7 +14,7 @@ * * @FieldType( * id = "string_long", - * label = @Translation("Plain long text"), + * label = @Translation("Text (plain, long)"), * description = @Translation("A field containing a long string value."), * default_widget = "string_textarea", * default_formatter = "string", diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php index e0fd255..fef53d1 100644 --- a/core/modules/comment/src/Tests/CommentFieldsTest.php +++ b/core/modules/comment/src/Tests/CommentFieldsTest.php @@ -114,24 +114,4 @@ function testCommentInstallAfterContentModule() { $this->postComment($book_node, $this->randomName(), $this->randomName()); } - /** - * Tests that comment module works correctly with plain text format. - */ - function testCommentFormat() { - // Disable text processing for comments. - $this->drupalLogin($this->admin_user); - $edit = array('instance[settings][text_processing]' => 0); - $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body', $edit, t('Save settings')); - - // Change formatter settings. - $this->drupalGet('admin/structure/comment/manage/comment/display'); - $edit = array('fields[comment_body][type]' => 'text_trimmed', 'refresh_rows' => 'comment_body'); - $commands = $this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh'))); - $this->assertTrue($commands, 'Ajax commands returned'); - - // Post a comment without an explicit subject. - $this->drupalLogin($this->web_user); - $edit = array('comment_body[0][value]' => $this->randomName(8)); - $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Save')); - } } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index bf6ea23..104e8cc 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -177,7 +177,7 @@ protected function setupTestFields() { entity_create('field_storage_config', array( 'name' => $this->fieldName, - 'type' => 'text', + 'type' => 'string', 'entity_type' => $this->entityTypeId, 'cardinality' => 1, 'translatable' => TRUE, @@ -190,7 +190,7 @@ protected function setupTestFields() { ))->save(); entity_get_form_display($this->entityTypeId, $this->bundle, 'default') ->setComponent($this->fieldName, array( - 'type' => 'text_textfield', + 'type' => 'string', 'weight' => 0, )) ->save(); diff --git a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php index e3f53fa..30f8379 100644 --- a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php @@ -45,7 +45,7 @@ protected function setUp() { $this->fieldStorages[3] = entity_create('field_storage_config', array( 'name' => 'field_name_3', 'entity_type' => 'node', - 'type' => 'text', + 'type' => 'string', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, )); $this->fieldStorages[3]->save(); @@ -53,7 +53,7 @@ protected function setUp() { $this->fieldStorages[4] = entity_create('field_storage_config', array( 'name' => 'field_name_4', 'entity_type' => 'node', - 'type' => 'text', + 'type' => 'string', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, )); $this->fieldStorages[4]->save(); @@ -135,7 +135,7 @@ public function _testFormatterSimpleFieldRender() { // @TODO: actually there should be a specific formatter. for ($i = 0; $i < 2; $i++) { $rendered_field = $view->style_plugin->getField($i, $this->fieldStorages[0]->getName()); - $this->assertEqual(strlen($rendered_field), 3); + $this->assertEqual(strlen(html_entity_decode($rendered_field)), 3); } } diff --git a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php index 9a26aca..7333a90 100644 --- a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php +++ b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php @@ -59,6 +59,7 @@ public function setUp() { parent::setUp(); $this->installSchema('system', array('router')); + $this->installConfig(array('filter')); \Drupal::service('router.builder')->rebuild(); } @@ -95,6 +96,9 @@ protected function assertFormatterRdfa($formatter, $property, $expected_rdf_valu // If verbose debugging is turned on, display the HTML and parsed RDF // in the results. if ($this->debug) { + debug($this->uri); + debug($property); + debug($expected_rdf_value); debug($output); debug($graph->toRdfPhp()); } diff --git a/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php index 6fdbdaf..f2eed6b 100644 --- a/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php @@ -6,6 +6,7 @@ namespace Drupal\rdf\Tests\Field; +use Drupal\Component\Utility\String; use Drupal\rdf\Tests\Field\FieldRdfaTestBase; /** @@ -62,13 +63,13 @@ public function setUp() { * @todo Check for the summary mapping. */ public function testAllFormatters() { + $formatted_value = strip_tags($this->entity->{$this->fieldName}->processed); + // Tests the default formatter. - $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/text', array('value' => $this->testValue)); - // Tests the plain formatter. - $this->assertFormatterRdfa(array('type'=>'string'), 'http://schema.org/text', array('value' => $this->testValue)); + $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/text', array('value' => $formatted_value)); // Tests the summary formatter. - $this->assertFormatterRdfa(array('type'=>'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $this->testValue)); + $this->assertFormatterRdfa(array('type'=>'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $formatted_value)); // Tests the trimmed formatter. - $this->assertFormatterRdfa(array('type'=>'text_trimmed'), 'http://schema.org/text', array('value' => $this->testValue)); + $this->assertFormatterRdfa(array('type'=>'text_trimmed'), 'http://schema.org/text', array('value' => $formatted_value)); } } diff --git a/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php index bc07bd0..2a03ae1 100644 --- a/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php +++ b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php @@ -46,7 +46,7 @@ function setUp() { /** * Tests EntityViewController. */ - function testEntityViewController() { + function dtestEntityViewController() { $get_label_markup = function($label) { return '
' . $value . ''; - } - }); - return strtr($message, $args); - } - - /** - * Gets the plain-text version of $this->content. - * - * @param string $content - * A (HTML) string. - * - * @return string - * The $content with all HTML tags stripped and all HTML entities replaced - * with their actual characters. - */ - protected function getPlainTextContent($content) { - // Strip all HTML tags. - $content = strip_tags($content); - // Decode all HTML entities (e.g., ' ') into characters. - $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8'); - return $content; - } - - /** - * Asserts that a raw string appears in $this->content. - * - * @param string $value - * The raw string to look for. - * @param string $message - * (optional) An assertion message. If omitted, a default message is used. - * Available placeholders: - * - @value: The $value. - * - @content: The current value of $this->content. - * @param array $args - * (optional) Additional replacement token map to pass to formatString(). - * - * @return bool - * TRUE on pass, FALSE on fail. - */ - protected function assertRaw($value, $message = NULL, $args = array()) { - if (!isset($message)) { - $message = 'Raw string @value found in @content'; - } - $args += array( - '@value' => $value, - '@content' => $this->content, - ); - return $this->assert(strpos($this->content, $value) !== FALSE, $this->formatString($message, $args)); - } - - /** - * Asserts that a raw string does not appear in $this->content. - * - * @param string $value - * The raw string to look for. - * @param string $message - * (optional) An assertion message. If omitted, a default message is used. - * Available placeholders: - * - @value: The $value. - * - @content: The current value of $this->content. - * @param array $args - * (optional) Additional replacement token map to pass to formatString(). - * - * @return bool - * TRUE on pass, FALSE on fail. - */ - protected function assertNoRaw($value, $message = NULL, $args = array()) { - if (!isset($message)) { - $message = 'Raw string @value not found in @content'; - } - $args += array( - '@value' => $value, - '@content' => $this->content, - ); - return $this->assert(strpos($this->content, $value) === FALSE, $this->formatString($message, $args)); - } - - /** - * Asserts that a text string appears in the text-only version of $this->content. - * - * @param string $value - * The text string to look for. - * @param string $message - * (optional) An assertion message. If omitted, a default message is used. - * Available placeholders: - * - @value: The $value. - * - @content: The current value of $this->content. - * @param array $args - * (optional) Additional replacement token map to pass to formatString(). - * - * @return bool - * TRUE on pass, FALSE on fail. - */ - protected function assertText($value, $message = NULL, $args = array()) { - if (!isset($message)) { - $message = 'Text string @value found in @content'; - } - $content = $this->getPlainTextContent($this->content); - $args += array( - '@value' => $value, - '@content' => $content, - ); - return $this->assert(strpos($content, $value) !== FALSE, $this->formatString($message, $args)); - } - - /** - * Asserts that a text string does not appear in the text-only version of $this->content. - * - * @param string $value - * The text string to look for. - * @param string $message - * (optional) An assertion message. If omitted, a default message is used. - * Available placeholders: - * - @value: The $value. - * - @content: The current value of $this->content. - * @param array $args - * (optional) Additional replacement token map to pass to formatString(). - * - * @return bool - * TRUE on pass, FALSE on fail. - */ - protected function assertNoText($value, $message = NULL, $args = array()) { - if (!isset($message)) { - $message = 'Text string @value not found in @content'; - } - $content = $this->getPlainTextContent($this->content); - $args += array( - '@value' => $value, - '@content' => $content, - ); - return $this->assert(strpos($content, $value) === FALSE, $this->formatString($message, $args)); - } - - /** - * Tests text_plain formatter output. - */ - function testPlainText() { - $value = $this->randomString(); - $value .= "\n\n" . $this->randomString() . ''; - $value .= "\n\n" . $this->randomString(); - - $entity = $this->createEntity(array()); - $entity->{$this->field_name}->value = $value; - - // Verify that all HTML is escaped and newlines are retained. - $this->renderEntityFields($entity, $this->display); - $this->assertText($value); - $this->assertNoRaw($value); - $this->assertRaw(nl2br(String::checkPlain($value))); - } - -}