.../Vocabulary/VocabularyHalJsonAnonTest.php | 46 ++++++++++++++++++ .../Vocabulary/VocabularyHalJsonBasicAuthTest.php | 53 +++++++++++++++++++++ .../Vocabulary/VocabularyJsonAnonTest.php | 40 ++++++++++++++++ .../Vocabulary/VocabularyJsonBasicAuthTest.php | 53 +++++++++++++++++++++ .../Vocabulary/VocabularyResourceTestBase.php | 54 ++++++++++++++++++++++ 5 files changed, 246 insertions(+) diff --git a/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonAnonTest.php new file mode 100644 index 0000000..8fb9946 --- /dev/null +++ b/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonAnonTest.php @@ -0,0 +1,46 @@ +grantPermissionsToAnonymousRole(['administer taxonomy']); + } + + // Disable the GET test coverage due to bug in taxonomy module. + // @todo Fix in https://www.drupal.org/node/2805281: remove this override. + public function testGet() {} + +} diff --git a/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonBasicAuthTest.php new file mode 100644 index 0000000..12ef15c --- /dev/null +++ b/core/modules/hal/tests/src/Functional/EntityResource/Vocabulary/VocabularyHalJsonBasicAuthTest.php @@ -0,0 +1,53 @@ +account = $this->createUser(['administer taxonomy']); + } + + // @todo Fix in https://www.drupal.org/node/2805281: remove this trait usage. + use HalJsonBasicAuthWorkaroundFor2805281Trait { + HalJsonBasicAuthWorkaroundFor2805281Trait::verifyResponseWhenMissingAuthentication insteadof BasicAuthResourceTestTrait; + } + +} diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonAnonTest.php b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonAnonTest.php new file mode 100644 index 0000000..7256e81 --- /dev/null +++ b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonAnonTest.php @@ -0,0 +1,40 @@ +grantPermissionsToAnonymousRole(['administer taxonomy']); + } + + // Disable the GET test coverage due to bug in taxonomy module. + // @todo Fix in https://www.drupal.org/node/2805281: remove this override. + public function testGet() {} + +} diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonBasicAuthTest.php b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonBasicAuthTest.php new file mode 100644 index 0000000..9308d02 --- /dev/null +++ b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyJsonBasicAuthTest.php @@ -0,0 +1,53 @@ +account = $this->createUser(['administer taxonomy']); + } + + // @todo Fix in https://www.drupal.org/node/2805281: remove this trait usage. + use JsonBasicAuthWorkaroundFor2805281Trait { + JsonBasicAuthWorkaroundFor2805281Trait::verifyResponseWhenMissingAuthentication insteadof BasicAuthResourceTestTrait; + } + +} diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyResourceTestBase.php new file mode 100644 index 0000000..8ec5fec --- /dev/null +++ b/core/modules/rest/tests/src/Functional/EntityResource/Vocabulary/VocabularyResourceTestBase.php @@ -0,0 +1,54 @@ + 'Llama', + 'vid' => 'llama', + ]); + $vocabulary->save(); + + return $vocabulary; + } + + /** + * {@inheritdoc} + */ + protected function getExpectedNormalizedEntity() { + assert('$this->entity instanceof \Drupal\Core\Entity\EntityInterface', 'Entity must already have been created.'); + return [ + 'uuid' => $this->entity->uuid(), + 'vid' => 'llama', + 'langcode' => 'en', + 'status' => TRUE, + 'dependencies' => [], + 'name' => 'Llama', + 'description' => NULL, + 'hierarchy' => 0, + 'weight' => 0, + ]; + } + +}