class VocabularyResourceTestBase
Same name and namespace in other branches
- 11.x core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase
- 10 core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase
- 8.9.x core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\Vocabulary\VocabularyResourceTestBase
- 8.9.x core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php \Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\rest\Functional\ResourceTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase extends \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase extends \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase extends \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase extends \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase extends \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of VocabularyResourceTestBase
3 files declare their use of VocabularyResourceTestBase
- VocabularyHalJsonAnonTest.php in core/
modules/ hal/ tests/ src/ Functional/ taxonomy/ VocabularyHalJsonAnonTest.php - VocabularyHalJsonBasicAuthTest.php in core/
modules/ hal/ tests/ src/ Functional/ taxonomy/ VocabularyHalJsonBasicAuthTest.php - VocabularyHalJsonCookieTest.php in core/
modules/ hal/ tests/ src/ Functional/ taxonomy/ VocabularyHalJsonCookieTest.php
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ Rest/ VocabularyResourceTestBase.php, line 8
Namespace
Drupal\Tests\taxonomy\Functional\RestView source
abstract class VocabularyResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'taxonomy',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'taxonomy_vocabulary';
/**
* @var \Drupal\taxonomy\VocabularyInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this->grantPermissionsToTestedRole([
'administer taxonomy',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$vocabulary = Vocabulary::create([
'name' => 'Llama',
'vid' => 'llama',
]);
$vocabulary->save();
return $vocabulary;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'uuid' => $this->entity
->uuid(),
'vid' => 'llama',
'langcode' => 'en',
'status' => TRUE,
'dependencies' => [],
'name' => 'Llama',
'description' => NULL,
'weight' => 0,
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
/**
* {@inheritdoc}
*/
protected function getExpectedUnauthorizedAccessMessage($method) {
if ($method === 'GET') {
return "The following permissions are required: 'access taxonomy overview' OR 'administer taxonomy'.";
}
return parent::getExpectedUnauthorizedAccessMessage($method);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.