class NormalizerTestBase
Same name in this branch
- 9 core/modules/hal/tests/src/Kernel/NormalizerTestBase.php \Drupal\Tests\hal\Kernel\NormalizerTestBase
Same name and namespace in other branches
- 11.x core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php \Drupal\Tests\serialization\Kernel\NormalizerTestBase
- 10 core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php \Drupal\Tests\serialization\Kernel\NormalizerTestBase
- 8.9.x core/modules/serialization/src/Tests/NormalizerTestBase.php \Drupal\serialization\Tests\NormalizerTestBase
- 8.9.x core/modules/serialization/tests/src/Kernel/NormalizerTestBase.php \Drupal\Tests\serialization\Kernel\NormalizerTestBase
- 8.9.x core/modules/hal/tests/src/Kernel/NormalizerTestBase.php \Drupal\Tests\hal\Kernel\NormalizerTestBase
Helper base class to set up some test fields for serialization testing.
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\serialization\Kernel\NormalizerTestBase extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of NormalizerTestBase
2 files declare their use of NormalizerTestBase
- EntityResolverTest.php in core/
modules/ hal/ tests/ src/ Kernel/ EntityResolverTest.php - FieldItemSerializationTest.php in core/
modules/ hal/ tests/ src/ Kernel/ serialization/ FieldItemSerializationTest.php
File
-
core/
modules/ serialization/ tests/ src/ Kernel/ NormalizerTestBase.php, line 12
Namespace
Drupal\Tests\serialization\KernelView source
abstract class NormalizerTestBase extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'serialization',
'system',
'field',
'entity_test',
'text',
'filter',
'user',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('entity_test_mulrev');
$this->installEntitySchema('user');
$this->installConfig([
'field',
]);
\Drupal::moduleHandler()->invoke('rest', 'install');
// Auto-create a field for testing.
FieldStorageConfig::create([
'entity_type' => 'entity_test_mulrev',
'field_name' => 'field_test_text',
'type' => 'text',
'cardinality' => 1,
'translatable' => FALSE,
])->save();
FieldConfig::create([
'entity_type' => 'entity_test_mulrev',
'field_name' => 'field_test_text',
'bundle' => 'entity_test_mulrev',
'label' => 'Test text-field',
'widget' => [
'type' => 'text_textfield',
'weight' => 0,
],
])->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.