ItemTest.php in JSON:API 8.2
File
tests/src/Functional/ItemTest.php
View source
<?php
namespace Drupal\Tests\jsonapi\Functional;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
class ItemTest extends ResourceTestBase {
use BcTimestampNormalizerUnixTestTrait;
public static $modules = [
'aggregator',
];
protected static $entityTypeId = 'aggregator_item';
protected static $resourceTypeName = 'aggregator_item--aggregator_item';
protected $entity;
protected static $patchProtectedFieldNames = [];
protected function setUpAuthorization($method) {
switch ($method) {
case 'GET':
$this
->grantPermissionsToTestedRole([
'access news feeds',
]);
break;
case 'POST':
case 'PATCH':
case 'DELETE':
$this
->grantPermissionsToTestedRole([
'administer news feeds',
]);
break;
}
}
protected function createEntity() {
$feed = Feed::create([
'title' => 'Camelids',
'url' => 'https://groups.drupal.org/not_used/167169',
'refresh' => 900,
'checked' => 1389919932,
'description' => 'Drupal Core Group feed',
]);
$feed
->save();
$item = Item::create();
$item
->setTitle('Llama')
->setFeedId($feed
->id())
->setLink('https://www.drupal.org/')
->setPostedTime(123456789)
->save();
return $item;
}
protected function createAnotherEntity($key) {
$duplicate = $this
->getEntityDuplicate($this->entity, $key);
$duplicate
->setLink('https://www.example.org/');
$duplicate
->save();
return $duplicate;
}
protected function getExpectedDocument() {
return [];
}
protected function getPostDocument() {
return [];
}
protected function getExpectedUnauthorizedAccessMessage($method) {
switch ($method) {
case 'GET':
return "The 'access news feeds' permission is required.";
case 'POST':
case 'PATCH':
case 'DELETE':
return "The 'administer news feeds' permission is required.";
}
}
public function testGetIndividual() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testCollection() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testRelated() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testRelationships() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testPostIndividual() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testPatchIndividual() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
public function testDeleteIndividual() {
$this
->markTestSkipped('Remove this override in https://www.drupal.org/project/drupal/issues/2149851');
}
}
Classes
Name |
Description |
ItemTest |
JSON:API integration test for the "Item" content entity type. |