diff --git a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php index 0b5d574..4cc2249 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\text\Tests\TextSummaryItemTest.. + * Contains \Drupal\text\Tests\TextSummaryItemTest. */ namespace Drupal\text\Tests; @@ -13,7 +13,7 @@ use Drupal\field\Tests\FieldUnitTestBase; /** - * Tests the entity API for the taxonomy term reference field type. + * Tests for \Drupal\text\Plugin\field\field_type\TextWithSummaryItem. */ class TextWithSummaryItemTest extends FieldUnitTestBase { @@ -55,12 +55,8 @@ public function setUp() { // Create the necessary formats. $this->installConfig(array('filter')); entity_create('filter_format', array( - 'format' => 'autop', - 'filters' => array( - /*'filter_autop' => array( - 'status' => 1, - ),*/ - ), + 'format' => 'no_filters', + 'filters' => array(), ))->save(); } @@ -101,45 +97,17 @@ public function testCrudAndUpdate() { $this->assertEqual($entity->summary_field->summary_processed, "

$summary

\n"); // Change the format, this should update the processed properties. - $entity->summary_field->format = 'autop'; + $entity->summary_field->format = 'no_filters'; $this->assertEqual($entity->summary_field->processed, $value); $this->assertEqual($entity->summary_field->summary_processed, $summary); } /** - * Creates a text_with_summary field and field instance. - * - * @param string $entity_type - * Entity type for which the field should be created. - */ - protected function createField($entity_type) { - // Create a field . - $this->field = entity_create('field_entity', array( - 'name' => 'summary_field', - 'entity_type' => $entity_type, - 'type' => 'text_with_summary', - 'settings' => array( - 'max_length' => 10, - ) - )); - $this->field->save(); - $this->instance = entity_create('field_instance', array( - 'field_name' => $this->field->name, - 'entity_type' => $entity_type, - 'bundle' => $entity_type, - 'settings' => array( - 'text_processing' => 0, - ) - )); - $this->instance->save(); - } - - /** * Tests that the processed values are cached. */ function testProcessedCache() { - // Use an entity type that has caching enabled. - $entity_type = 'entity_test_rev'; + // Use an entity type that has caching enabled. + $entity_type = 'entity_test_rev'; $this->createField($entity_type); @@ -173,9 +141,37 @@ function testProcessedCache() { $this->assertEqual($entity->summary_field->summary_processed, 'Cached summary processed value'); // Change the format, this should update the processed properties. - $entity->summary_field->format = 'autop'; + $entity->summary_field->format = 'no_filters'; $this->assertEqual($entity->summary_field->processed, $value); $this->assertEqual($entity->summary_field->summary_processed, $summary); } + /** + * Creates a text_with_summary field and field instance. + * + * @param string $entity_type + * Entity type for which the field should be created. + */ + protected function createField($entity_type) { + // Create a field . + $this->field = entity_create('field_entity', array( + 'name' => 'summary_field', + 'entity_type' => $entity_type, + 'type' => 'text_with_summary', + 'settings' => array( + 'max_length' => 10, + ) + )); + $this->field->save(); + $this->instance = entity_create('field_instance', array( + 'field_name' => $this->field->name, + 'entity_type' => $entity_type, + 'bundle' => $entity_type, + 'settings' => array( + 'text_processing' => 0, + ) + )); + $this->instance->save(); + } + }