TextFieldRdfaTest.php in Zircon Profile 8
File
core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php
View source
<?php
namespace Drupal\rdf\Tests\Field;
class TextFieldRdfaTest extends FieldRdfaTestBase {
protected $fieldType = 'text';
protected $testValue = 'test_text_value';
protected $testSummary = 'test_summary_value';
public static $modules = array(
'text',
'filter',
);
protected function setUp() {
parent::setUp();
$this
->installConfig(array(
'filter',
));
$this
->createTestField();
$mapping = rdf_get_mapping('entity_test', 'entity_test');
$mapping
->setFieldMapping($this->fieldName, array(
'properties' => array(
'schema:text',
),
))
->save();
$this->entity = entity_create('entity_test');
$this->entity->{$this->fieldName}->value = $this->testValue;
$this->entity->{$this->fieldName}->summary = $this->testSummary;
}
public function testAllFormatters() {
$formatted_value = strip_tags($this->entity->{$this->fieldName}->processed);
$this
->assertFormatterRdfa(array(
'type' => 'text_default',
), 'http://schema.org/text', array(
'value' => $formatted_value,
));
$this
->assertFormatterRdfa(array(
'type' => 'text_summary_or_trimmed',
), 'http://schema.org/text', array(
'value' => $formatted_value,
));
$this
->assertFormatterRdfa(array(
'type' => 'text_trimmed',
), 'http://schema.org/text', array(
'value' => $formatted_value,
));
}
}