protected function FakeAuthorizationController::handleHandshake in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 4.0.x tests/modules/lingotek_test/src/Controller/FakeAuthorizationController.php \Drupal\lingotek_test\Controller\FakeAuthorizationController::handleHandshake()
- 3.4.x tests/modules/lingotek_test/src/Controller/FakeAuthorizationController.php \Drupal\lingotek_test\Controller\FakeAuthorizationController::handleHandshake()
- 3.6.x tests/modules/lingotek_test/src/Controller/FakeAuthorizationController.php \Drupal\lingotek_test\Controller\FakeAuthorizationController::handleHandshake()
- 3.7.x tests/modules/lingotek_test/src/Controller/FakeAuthorizationController.php \Drupal\lingotek_test\Controller\FakeAuthorizationController::handleHandshake()
- 3.8.x tests/modules/lingotek_test/src/Controller/FakeAuthorizationController.php \Drupal\lingotek_test\Controller\FakeAuthorizationController::handleHandshake()
1 call to FakeAuthorizationController::handleHandshake()
- FakeAuthorizationController::authorize in tests/
modules/ lingotek_test/ src/ Controller/ FakeAuthorizationController.php
File
- tests/
modules/ lingotek_test/ src/ Controller/ FakeAuthorizationController.php, line 28
Class
Namespace
Drupal\lingotek_test\ControllerCode
protected function handleHandshake(Request $request) {
// Simulate the notification of content successfully uploaded.
$urlHandshake = Url::fromRoute('lingotek.setup_account_handshake')
->setAbsolute()
->toString();
$domain = parse_url($urlHandshake, PHP_URL_HOST);
$requestToken = \Drupal::httpClient()
->post($urlHandshake, [
'body' => '{"access_token":"' . self::ACCESS_TOKEN . '"}',
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'cookies' => CookieJar::fromArray($request->cookies
->all(), $domain),
'http_errors' => FALSE,
]);
assert(200 === $requestToken
->getStatusCode());
$response = Json::decode($requestToken
->getBody());
assert($response['status']);
}