Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / aggregator / tests / src / Functional / Hal / FeedHalJsonTestBase.php
1 <?php
2
3 namespace Drupal\Tests\aggregator\Functional\Hal;
4
5 use Drupal\Tests\aggregator\Functional\Rest\FeedResourceTestBase;
6 use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait;
7
8 abstract class FeedHalJsonTestBase extends FeedResourceTestBase {
9
10   use HalEntityNormalizationTrait;
11
12   /**
13    * {@inheritdoc}
14    */
15   public static $modules = ['hal'];
16
17   /**
18    * {@inheritdoc}
19    */
20   protected static $format = 'hal_json';
21
22   /**
23    * {@inheritdoc}
24    */
25   protected static $mimeType = 'application/hal+json';
26
27   /**
28    * {@inheritdoc}
29    */
30   protected function getExpectedNormalizedEntity() {
31     $default_normalization = parent::getExpectedNormalizedEntity();
32
33     $normalization = $this->applyHalFieldNormalization($default_normalization);
34
35     return $normalization + [
36       '_links' => [
37         'self' => [
38           'href' => $this->baseUrl . '/aggregator/sources/1?_format=hal_json',
39         ],
40         'type' => [
41           'href' => $this->baseUrl . '/rest/type/aggregator_feed/aggregator_feed',
42         ],
43       ],
44     ];
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   protected function getNormalizedPostEntity() {
51     return parent::getNormalizedPostEntity() + [
52       '_links' => [
53         'type' => [
54           'href' => $this->baseUrl . '/rest/type/aggregator_feed/aggregator_feed',
55         ],
56       ],
57     ];
58   }
59
60 }