You are here

public function ConfigurableFieldManagerTest::testInvalidDelete in Commerce Core 8.2

Tests trying to delete an unknown field.

File

tests/src/Kernel/ConfigurableFieldManagerTest.php, line 102

Class

ConfigurableFieldManagerTest
Tests the ConfigurableFieldManager class.

Namespace

Drupal\Tests\commerce\Kernel

Code

public function testInvalidDelete() {
  $field_definition = BundleFieldDefinition::create('entity_reference')
    ->setTargetEntityTypeId('entity_test')
    ->setTargetBundle('entity_test')
    ->setName('stores');
  $expected_message = 'The field "stores" does not exist on bundle "entity_test" of entity type "entity_test".';
  $this
    ->expectException(\RuntimeException::class);
  $this
    ->expectExceptionMessage($expected_message);
  $this->configurableFieldManager
    ->deleteField($field_definition);
}