public function JsonApiRegressionTest::testGetTermWhenMultipleVocabulariesExistFromIssue2977879 in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php \Drupal\Tests\jsonapi\Functional\JsonApiRegressionTest::testGetTermWhenMultipleVocabulariesExistFromIssue2977879()
- 10 core/modules/jsonapi/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/drupal/issues/2977879
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ JsonApiRegressionTest.php, line 207
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
->getAccountName(),
$user->pass_raw,
],
]);
$this
->assertSame(200, $response
->getStatusCode());
}