You are here

public function LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments in Lingotek Translation 3.3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  2. 4.0.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  3. 3.0.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  4. 3.1.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  5. 3.2.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  6. 3.4.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  7. 3.5.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  8. 3.6.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  9. 3.7.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()
  10. 3.8.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::testNotificationCallbackWithNoArguments()

Tests notification callbacks without any arguments, like in a browser.

File

tests/src/Functional/LingotekNodeNotificationCallbackTest.php, line 66

Class

LingotekNodeNotificationCallbackTest
Tests translating a node using the notification callback.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNotificationCallbackWithNoArguments() {
  $assert_session = $this
    ->assertSession();

  // Simulate the notification of an empty request.
  $url = Url::fromRoute('lingotek.notify', [], [])
    ->setAbsolute()
    ->toString();
  $request = $this->client
    ->post($url, [
    'cookies' => $this->cookies,
    'headers' => [
      'Accept' => 'application/json',
      'Content-Type' => 'application/json',
    ],
    'http_errors' => FALSE,
  ]);
  $this
    ->assertEquals($request
    ->getStatusCode(), Response::HTTP_ACCEPTED);
  $this
    ->assertEquals('It works, but nothing to look here.', (string) $request
    ->getBody());
  $this
    ->drupalGet('lingotek/notify');
  $assert_session
    ->statusCodeEquals(Response::HTTP_ACCEPTED);
  $assert_session
    ->responseContains('It works, but nothing to look here.');
}