diff --git a/src/Exception/CircuitException.php b/src/Exception/CircuitException.php index a2300a7..0e3f2b1 100644 --- a/src/Exception/CircuitException.php +++ b/src/Exception/CircuitException.php @@ -36,4 +36,12 @@ public function __construct( parent::__construct($message, $code, $previous); $this->serviceName = $serviceName; } + + /** + * @return string + */ + public function getServiceName(): string + { + return $this->serviceName; + } } \ No newline at end of file diff --git a/tests/Unit/Exception/CircuitExceptionTest.php b/tests/Unit/Exception/CircuitExceptionTest.php new file mode 100644 index 0000000..2925e1e --- /dev/null +++ b/tests/Unit/Exception/CircuitExceptionTest.php @@ -0,0 +1,27 @@ + + */ +class CircuitExceptionTest extends TestCase +{ + /** + * Test if the exception holds the service-name. + */ + public function testExceptionWithServiceName() + { + $serviceName = 'TEST_SERVICE_NAME'; + $exception = new CircuitException($serviceName); + $this->assertEquals($serviceName, $exception->getServiceName()); + } +} \ No newline at end of file