| @@ 30-44 (lines=15) @@ | ||
| 27 | /** |
|
| 28 | * @covers \AmericanExpress\HyperledgerFabricClient\Exception\BadMethodCallException |
|
| 29 | */ |
|
| 30 | class BadMethodCallExceptionTest extends TestCase |
|
| 31 | { |
|
| 32 | public function testFromException() |
|
| 33 | { |
|
| 34 | $exception = new \BadMethodCallException('FooBar', 1234, new \Exception()); |
|
| 35 | ||
| 36 | $result = BadMethodCallException::fromException($exception); |
|
| 37 | ||
| 38 | self::assertInstanceOf(BadMethodCallException::class, $result); |
|
| 39 | self::assertInstanceOf(ExceptionInterface::class, $result); |
|
| 40 | self::assertSame('FooBar', $result->getMessage()); |
|
| 41 | self::assertSame(1234, $result->getCode()); |
|
| 42 | self::assertSame($exception, $result->getPrevious()); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 30-44 (lines=15) @@ | ||
| 27 | /** |
|
| 28 | * @covers \AmericanExpress\HyperledgerFabricClient\Exception\InvalidArgumentException |
|
| 29 | */ |
|
| 30 | class InvalidArgumentExceptionTest extends TestCase |
|
| 31 | { |
|
| 32 | public function testFromException() |
|
| 33 | { |
|
| 34 | $exception = new \InvalidArgumentException('FooBar', 1234, new \Exception()); |
|
| 35 | ||
| 36 | $result = InvalidArgumentException::fromException($exception); |
|
| 37 | ||
| 38 | self::assertInstanceOf(InvalidArgumentException::class, $result); |
|
| 39 | self::assertInstanceOf(ExceptionInterface::class, $result); |
|
| 40 | self::assertSame('FooBar', $result->getMessage()); |
|
| 41 | self::assertSame(1234, $result->getCode()); |
|
| 42 | self::assertSame($exception, $result->getPrevious()); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 30-44 (lines=15) @@ | ||
| 27 | /** |
|
| 28 | * @covers \AmericanExpress\HyperledgerFabricClient\Exception\RuntimeException |
|
| 29 | */ |
|
| 30 | class RuntimeExceptionTest extends TestCase |
|
| 31 | { |
|
| 32 | public function testFromException() |
|
| 33 | { |
|
| 34 | $exception = new \RuntimeException('FooBar', 1234, new \Exception()); |
|
| 35 | ||
| 36 | $result = RuntimeException::fromException($exception); |
|
| 37 | ||
| 38 | self::assertInstanceOf(RuntimeException::class, $result); |
|
| 39 | self::assertInstanceOf(ExceptionInterface::class, $result); |
|
| 40 | self::assertSame('FooBar', $result->getMessage()); |
|
| 41 | self::assertSame(1234, $result->getCode()); |
|
| 42 | self::assertSame($exception, $result->getPrevious()); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 30-44 (lines=15) @@ | ||
| 27 | /** |
|
| 28 | * @covers \AmericanExpress\HyperledgerFabricClient\Exception\UnexpectedValueException |
|
| 29 | */ |
|
| 30 | class UnexpectedValueExceptionTest extends TestCase |
|
| 31 | { |
|
| 32 | public function testFromException() |
|
| 33 | { |
|
| 34 | $exception = new \UnexpectedValueException('FooBar', 1234, new \Exception()); |
|
| 35 | ||
| 36 | $result = UnexpectedValueException::fromException($exception); |
|
| 37 | ||
| 38 | self::assertInstanceOf(UnexpectedValueException::class, $result); |
|
| 39 | self::assertInstanceOf(ExceptionInterface::class, $result); |
|
| 40 | self::assertSame('FooBar', $result->getMessage()); |
|
| 41 | self::assertSame(1234, $result->getCode()); |
|
| 42 | self::assertSame($exception, $result->getPrevious()); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||