You are here

public function ConfigEntityBaseUnitTest::testToArraySchemaException in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testToArraySchemaException()

@covers ::toArray

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php, line 631
Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.

Class

ConfigEntityBaseUnitTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testToArraySchemaException() {
  $this->entityType
    ->expects($this
    ->any())
    ->method('getPropertiesToExport')
    ->willReturn(NULL);
  $this->entityType
    ->expects($this
    ->any())
    ->method('getClass')
    ->willReturn("FooConfigEntity");
  $this
    ->expectException(SchemaIncompleteException::class);
  $this
    ->expectExceptionMessage("Entity type 'FooConfigEntity' is missing 'config_export' definition in its annotation");
  $this->entity
    ->toArray();
}