You are here

public function ExceptionTest::testConstructorArrayMessage in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest::testConstructorArrayMessage()
  2. 8.2 vendor/smartling/api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest::testConstructorArrayMessage()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest::testConstructorArrayMessage()
  2. 8.3 vendor/smartling/api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest::testConstructorArrayMessage()

Check exception's constructor with array of errors passed in.

File

api-sdk-php/tests/unit/ExceptionTest.php, line 27

Class

ExceptionTest
Test class for Smartling\Exceptions\SmartlingApiException.

Namespace

Smartling\Tests

Code

public function testConstructorArrayMessage() {
  $exceptionArray = [
    'errors' => [
      [
        'key' => 'error_key',
        'message' => 'Error message.',
        'details' => [
          'errorId' => 'error_id',
        ],
      ],
    ],
  ];
  $e = new SmartlingApiException($exceptionArray);
  $this
    ->assertTrue(is_string($e
    ->getMessage()));
  $this
    ->assertNotEmpty($e
    ->getMessage());
  $this
    ->assertSame(print_r($exceptionArray, TRUE), $e
    ->getMessage());
}