You are here

public function AcsfMessageTest::testAcsfMessageResponse in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 tests/AcsfMessageTest.php \AcsfMessageTest::testAcsfMessageResponse()

Tests message sending and response works as expected.

File

tests/AcsfMessageTest.php, line 68
Provides PHPUnit tests for AcsfMessage.

Class

AcsfMessageTest
AcsfMessageTest.

Code

public function testAcsfMessageResponse() {
  $config = new AcsfConfigUnitTest('unit_test_site', 'unit_test_env');
  $message = new AcsfMessageUnitTestSuccess('TEST', 'unit_test_endpoint', [], $config);
  $message
    ->send();
  $response = $message
    ->getResponseBody();
  $expected_response = [
    'url' => 'http://gardener.unit.test',
    'method' => 'TEST',
    'endpoint' => 'unit_test_endpoint',
    'parameters' => [],
    'username' => 'gardener_unit_test',
    'password' => 'Un1tT35t',
  ];
  $this
    ->assertSame($response, json_encode($expected_response));
}