From ac143ad846117d433a6d68e1b3f3468fd57a3a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9B=B8=E8=BD=A9?= <NauxLiu@users.noreply.github.com> Date: Fri, 23 Jun 2017 18:22:02 +0800 Subject: [PATCH 1/2] Add exception class name to failed message --- src/monitor.php | 2 +- tests/MonitorTaskTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monitor.php b/src/monitor.php index 818ddb2..486521e 100644 --- a/src/monitor.php +++ b/src/monitor.php @@ -10,7 +10,7 @@ function cronitorMonitorTask($client, $closure, $exceptionHandler = false) $pause = false; if (!$exceptionHandler) { - $msg = $e->getMessage(); + $msg = get_class($e) . " with message '" . $e->getMessage() . "'"; } else { // $exceptionHandler should return an array like the following: // array( diff --git a/tests/MonitorTaskTest.php b/tests/MonitorTaskTest.php index d2ee32f..998d8fc 100644 --- a/tests/MonitorTaskTest.php +++ b/tests/MonitorTaskTest.php @@ -51,7 +51,7 @@ public function test_it_should_send_exceptions_message_on_failure() $client->expects($this->once()) ->method('fail') - ->with($msg); + ->with("Exception with message '{$msg}'"); cronitorMonitorTask( $client, From 88ade62ab10ae0da76fee1b669c7b4fc8491c25a Mon Sep 17 00:00:00 2001 From: Xiangxuan Liu <xiangxuan.liu@rightcapital.com> Date: Fri, 23 Jun 2017 18:34:44 +0800 Subject: [PATCH 2/2] Fix code style. --- tests/MonitorTaskTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/MonitorTaskTest.php b/tests/MonitorTaskTest.php index 998d8fc..8ded24c 100644 --- a/tests/MonitorTaskTest.php +++ b/tests/MonitorTaskTest.php @@ -7,7 +7,6 @@ class MonitorTaskTest extends TestBase { - public function test_it_should_return_value_on_success() { $client = $this->getOkClient();