comparison core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\FunctionalTests\Rest;
4
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\Core\Entity\Entity\EntityFormMode;
7
8 abstract class EntityFormModeResourceTestBase extends EntityResourceTestBase {
9
10 /**
11 * {@inheritdoc}
12 *
13 * @todo: Remove 'field_ui' when https://www.drupal.org/node/2867266.
14 */
15 public static $modules = ['user', 'field_ui'];
16
17 /**
18 * {@inheritdoc}
19 */
20 protected static $entityTypeId = 'entity_form_mode';
21
22 /**
23 * @var \Drupal\Core\Entity\EntityFormModeInterface
24 */
25 protected $entity;
26
27 /**
28 * {@inheritdoc}
29 */
30 protected function setUpAuthorization($method) {
31 $this->grantPermissionsToTestedRole(['administer display modes']);
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 protected function createEntity() {
38 $entity_form_mode = EntityFormMode::create([
39 'id' => 'user.test',
40 'label' => 'Test',
41 'targetEntityType' => 'user',
42 ]);
43 $entity_form_mode->save();
44 return $entity_form_mode;
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 protected function getExpectedNormalizedEntity() {
51 return [
52 'cache' => TRUE,
53 'dependencies' => [
54 'module' => [
55 'user',
56 ],
57 ],
58 'id' => 'user.test',
59 'label' => 'Test',
60 'langcode' => 'en',
61 'status' => TRUE,
62 'targetEntityType' => 'user',
63 'uuid' => $this->entity->uuid(),
64 ];
65 }
66
67 /**
68 * {@inheritdoc}
69 */
70 protected function getNormalizedPostEntity() {
71 // @todo Update in https://www.drupal.org/node/2300677.
72 }
73
74 }