From 2a38605545e26ce68a37e5ebb877fd9c9875a37d Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 17 Jan 2018 15:21:56 +0100 Subject: Properly log the full exception instead of only the message Signed-off-by: Morris Jobke --- .../provisioning_api/tests/Controller/UsersControllerTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'apps/provisioning_api/tests') diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index ef47583e9df..c2ad36c455c 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -414,6 +414,7 @@ class UsersControllerTest extends TestCase { * @expectedExceptionMessage Bad request */ public function testAddUserUnsuccessful() { + $exception = new Exception('User backend not found.'); $this->userManager ->expects($this->once()) ->method('userExists') @@ -423,11 +424,15 @@ class UsersControllerTest extends TestCase { ->expects($this->once()) ->method('createUser') ->with('NewUser', 'PasswordOfTheNewUser') - ->will($this->throwException(new Exception('User backend not found.'))); + ->will($this->throwException($exception)); $this->logger ->expects($this->once()) - ->method('error') - ->with('Failed addUser attempt with exception: User backend not found.', ['app' => 'ocs_api']); + ->method('logException') + ->with($exception, [ + 'message' => 'Failed addUser attempt with exception.', + 'level' => \OCP\Util::ERROR, + 'app' => 'ocs_api', + ]); $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); -- cgit v1.2.3