Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Plugin / EntityContextTypedDataTest.php
1 <?php
2
3 namespace Drupal\KernelTests\Core\Plugin;
4
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\Core\Plugin\Context\EntityContext;
7 use Drupal\KernelTests\KernelTestBase;
8
9 /**
10  * Tests the interaction between entity context and typed data.
11  *
12  * @group Context
13  */
14 class EntityContextTypedDataTest extends KernelTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   protected static $modules = ['entity_test'];
20
21   /**
22    * Tests that entity contexts wrapping a config entity can be validated.
23    */
24   public function testValidateConfigEntityContext() {
25     $display = EntityViewDisplay::create([
26       'targetEntityType' => 'entity_test',
27       'bundle' => 'entity_test',
28       'mode' => 'default',
29       'status' => TRUE,
30     ]);
31     $display->save();
32
33     $violations = EntityContext::fromEntity($display)->validate();
34     $this->assertCount(0, $violations);
35   }
36
37 }