Skip to content

Commit

Permalink
[ECVS-6] added test case: fault code empty, message empty, default co…
Browse files Browse the repository at this point in the history
…de, prev exception not set.
  • Loading branch information
arslanim committed Dec 23, 2023
1 parent b1d4234 commit 2ac62d2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/unit/exceptions/service/UnknownServiceErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,37 @@ public function getDefaultCreateExceptionProvidedData(): array
],
];
}

/**
* @dataProvider getDefaultCreateExceptionProvidedData
*/
public function testCreateException(array $exceptionData, array $expectedExceptionData): void
{
$exception = new UnknownServiceErrorException($exceptionData['faultCode']);

$this->assertEquals($expectedExceptionData['expectedFaultCode'], $exception->getFaultCode());
$this->assertEquals($expectedExceptionData['expectedMessage'], $exception->getMessage());
$this->assertEquals($expectedExceptionData['expectedCode'], $exception->getCode());
$this->assertEquals($expectedExceptionData['expectedPrevException'], $exception->getPrevious());
}

public function getCreateExceptionProvidedData(): array
{
return [
'fault code empty, message empty, default code, prev exception not set' => [
'exceptionData' => [
'faultCode' => '',
'message' => '',
'code' => 0,
'prevException' => null,
],
'expectedExceptionData' => [
'expectedFaultCode' => '',
'expectedMessage' => '',
'expectedCode' => 0,
'expectedPrevException' => null,
],
],
];
}
}

0 comments on commit 2ac62d2

Please sign in to comment.