public function JsonApiRegressionTest::testGetTermWhenMultipleVocabulariesExistFromIssue2977879 in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/JsonApiRegressionTest.php \Drupal\Tests\jsonapi\Functional\JsonApiRegressionTest::testGetTermWhenMultipleVocabulariesExistFromIssue2977879()
Ensures GETting terms works when multiple vocabularies exist.
See also
https://www.drupal.org/project/jsonapi/issues/2977879
File
- tests/
src/ Functional/ JsonApiRegressionTest.php, line 182
Class
- JsonApiRegressionTest
- JSON API regression tests.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
public function testGetTermWhenMultipleVocabulariesExistFromIssue2977879() {
// Set up data model.
$this
->assertTrue($this->container
->get('module_installer')
->install([
'taxonomy',
], TRUE), 'Installed modules.');
Vocabulary::create([
'name' => 'one',
'vid' => 'one',
])
->save();
Vocabulary::create([
'name' => 'two',
'vid' => 'two',
])
->save();
$this
->rebuildAll();
// Create data.
Term::create([
'vid' => 'one',
])
->setName('Test')
->save();
// Test.
$user = $this
->drupalCreateUser([
'access content',
]);
$response = $this
->request('GET', Url::fromUri('internal:/jsonapi/taxonomy_term/one'), [
RequestOptions::AUTH => [
$user
->getUsername(),
$user->pass_raw,
],
]);
$this
->assertSame(200, $response
->getStatusCode());
}