public function LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
- 3.3.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
- 3.4.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
- 3.5.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
- 3.6.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
- 3.8.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanNotAddLanguageWithoutPermission()
Test that a language can't be added.
File
- tests/
src/ Functional/ LingotekDashboardTest.php, line 64
Class
- LingotekDashboardTest
- Tests the Lingotek dashboard.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDashboardCanNotAddLanguageWithoutPermission() {
$url = Url::fromRoute('lingotek.dashboard_endpoint')
->setAbsolute()
->toString();
$no_administer_languages = $this
->createUser([
'administer lingotek',
]);
$this
->drupalLogin($no_administer_languages);
$post = [
'code' => 'it_IT',
'language' => 'Italian',
'native' => 'Italiano',
'direction' => '',
];
$request = $this->client
->post($url, [
'body' => http_build_query($post),
'cookies' => $this->cookies,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/x-www-form-urlencoded',
],
'http_errors' => FALSE,
]);
$response = json_decode($request
->getBody(), TRUE);
$this
->assertEquals($request
->getStatusCode(), Response::HTTP_FORBIDDEN);
}