class ExceptionTest in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.2 api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest
- 8.2 vendor/smartling/api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest
- 8.3 vendor/smartling/api-sdk-php/tests/unit/ExceptionTest.php \Smartling\Tests\ExceptionTest
Test class for Smartling\Exceptions\SmartlingApiException.
Hierarchy
- class \Smartling\Tests\ExceptionTest extends \Smartling\Tests\PHPUnit_Framework_TestCase
Expanded class hierarchy of ExceptionTest
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ ExceptionTest.php, line 9
Namespace
Smartling\TestsView source
class ExceptionTest extends \PHPUnit_Framework_TestCase {
/**
* Check exception's constructor with string error passed in.
*/
public function testConstructorStringMessage() {
$exceptionMessage = 'Exception message';
$e = new SmartlingApiException($exceptionMessage);
$this
->assertTrue(is_string($e
->getMessage()));
$this
->assertNotEmpty($e
->getMessage());
$this
->assertSame($exceptionMessage, $e
->getMessage());
}
/**
* Check exception's constructor with array of errors passed in.
*/
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());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExceptionTest:: |
public | function | Check exception's constructor with array of errors passed in. | |
ExceptionTest:: |
public | function | Check exception's constructor with string error passed in. |