public function FieldCreateTest::testInvalidFields in Organic groups 8
Testing invalid field creation.
File
- tests/
src/ Kernel/ Entity/ FieldCreateTest.php, line 101
Class
- FieldCreateTest
- Testing field definition overrides.
Namespace
Drupal\Tests\og\Kernel\EntityCode
public function testInvalidFields() {
// Unknown plugin.
$bundle = $this->bundles[0];
try {
Og::CreateField('undefined_field_name', 'node', $bundle);
$this
->fail('Undefined field name was attached');
} catch (\Exception $e) {
}
// Field that can be attached only to a certain entity type, being attached
// to another one.
try {
Og::CreateField('entity_restricted', 'user', 'user');
$this
->fail('Field was attached to a prohibited entity type.');
} catch (\Exception $e) {
}
}