Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/jsonapi/tests/src/Functional/ItemTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\jsonapi\Functional; | |
4 | |
5 use Drupal\aggregator\Entity\Feed; | |
6 use Drupal\aggregator\Entity\Item; | |
7 use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait; | |
8 | |
9 /** | |
10 * JSON:API integration test for the "Item" content entity type. | |
11 * | |
12 * @group jsonapi | |
13 */ | |
14 class ItemTest extends ResourceTestBase { | |
15 | |
16 use BcTimestampNormalizerUnixTestTrait; | |
17 | |
18 /** | |
19 * {@inheritdoc} | |
20 */ | |
21 public static $modules = ['aggregator']; | |
22 | |
23 /** | |
24 * {@inheritdoc} | |
25 */ | |
26 protected static $entityTypeId = 'aggregator_item'; | |
27 | |
28 /** | |
29 * {@inheritdoc} | |
30 */ | |
31 protected static $resourceTypeName = 'aggregator_item--aggregator_item'; | |
32 | |
33 /** | |
34 * {@inheritdoc} | |
35 * | |
36 * @var \Drupal\aggregator\ItemInterface | |
37 */ | |
38 protected $entity; | |
39 | |
40 /** | |
41 * {@inheritdoc} | |
42 */ | |
43 protected static $patchProtectedFieldNames = []; | |
44 | |
45 /** | |
46 * {@inheritdoc} | |
47 */ | |
48 protected function setUpAuthorization($method) { | |
49 switch ($method) { | |
50 case 'GET': | |
51 $this->grantPermissionsToTestedRole(['access news feeds']); | |
52 break; | |
53 | |
54 case 'POST': | |
55 case 'PATCH': | |
56 case 'DELETE': | |
57 $this->grantPermissionsToTestedRole(['administer news feeds']); | |
58 break; | |
59 } | |
60 } | |
61 | |
62 /** | |
63 * {@inheritdoc} | |
64 */ | |
65 protected function createEntity() { | |
66 // Create a "Camelids" feed. | |
67 $feed = Feed::create([ | |
68 'title' => 'Camelids', | |
69 'url' => 'https://groups.drupal.org/not_used/167169', | |
70 'refresh' => 900, | |
71 'checked' => 1389919932, | |
72 'description' => 'Drupal Core Group feed', | |
73 ]); | |
74 $feed->save(); | |
75 | |
76 // Create a "Llama" item. | |
77 $item = Item::create(); | |
78 $item->setTitle('Llama') | |
79 ->setFeedId($feed->id()) | |
80 ->setLink('https://www.drupal.org/') | |
81 ->setPostedTime(123456789) | |
82 ->save(); | |
83 | |
84 return $item; | |
85 } | |
86 | |
87 /** | |
88 * {@inheritdoc} | |
89 */ | |
90 protected function createAnotherEntity($key) { | |
91 $duplicate = $this->getEntityDuplicate($this->entity, $key); | |
92 $duplicate->setLink('https://www.example.org/'); | |
93 $duplicate->save(); | |
94 return $duplicate; | |
95 } | |
96 | |
97 /** | |
98 * {@inheritdoc} | |
99 */ | |
100 protected function getExpectedDocument() { | |
101 return []; | |
102 } | |
103 | |
104 /** | |
105 * {@inheritdoc} | |
106 */ | |
107 protected function getPostDocument() { | |
108 return []; | |
109 } | |
110 | |
111 /** | |
112 * {@inheritdoc} | |
113 */ | |
114 protected function getExpectedUnauthorizedAccessMessage($method) { | |
115 switch ($method) { | |
116 case 'GET': | |
117 return "The 'access news feeds' permission is required."; | |
118 | |
119 case 'POST': | |
120 case 'PATCH': | |
121 case 'DELETE': | |
122 return "The 'administer news feeds' permission is required."; | |
123 } | |
124 } | |
125 | |
126 /** | |
127 * {@inheritdoc} | |
128 */ | |
129 public function testGetIndividual() { | |
130 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
131 } | |
132 | |
133 /** | |
134 * {@inheritdoc} | |
135 */ | |
136 public function testCollection() { | |
137 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
138 } | |
139 | |
140 /** | |
141 * {@inheritdoc} | |
142 */ | |
143 public function testRelated() { | |
144 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
145 } | |
146 | |
147 /** | |
148 * {@inheritdoc} | |
149 */ | |
150 public function testRelationships() { | |
151 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
152 } | |
153 | |
154 /** | |
155 * {@inheritdoc} | |
156 */ | |
157 public function testPostIndividual() { | |
158 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
159 } | |
160 | |
161 /** | |
162 * {@inheritdoc} | |
163 */ | |
164 public function testPatchIndividual() { | |
165 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
166 } | |
167 | |
168 /** | |
169 * {@inheritdoc} | |
170 */ | |
171 public function testDeleteIndividual() { | |
172 $this->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851'); | |
173 } | |
174 | |
175 } |