From b6dd2ebd3909017b9a5dbe0e145d6c5041a9043c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 26 Jul 2019 15:21:41 +0200 Subject: Use proper exception in lostController There is no need to log the expcetion of most of the stuff here. We should properly log them but an exception is excessive. This moves it to a proper exception which we can catch and then log. The other exceptions will still be fully logged. Signed-off-by: Roeland Jago Douma --- tests/Core/Controller/LostControllerTest.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 8500819a9ca..41f3bb03f02 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -275,8 +275,10 @@ class LostControllerTest extends \Test\TestCase { array(false, $nonExistingUser) ))); - $this->logger->expects($this->exactly(2)) + $this->logger->expects($this->exactly(0)) ->method('logException'); + $this->logger->expects($this->exactly(2)) + ->method('warning'); $this->userManager ->method('getByEmail') @@ -722,8 +724,10 @@ class LostControllerTest extends \Test\TestCase { ->with('ExistingUser') ->willReturn($user); - $this->logger->expects($this->exactly(1)) + $this->logger->expects($this->exactly(0)) ->method('logException'); + $this->logger->expects($this->once()) + ->method('warning'); $response = $this->lostController->email('ExistingUser'); $expectedResponse = new JSONResponse(['status' => 'success']); @@ -807,8 +811,10 @@ class LostControllerTest extends \Test\TestCase { ->method('getByEmail') ->willReturn([$user1, $user2]); - $this->logger->expects($this->exactly(1)) + $this->logger->expects($this->exactly(0)) ->method('logException'); + $this->logger->expects($this->once()) + ->method('warning'); // request password reset for test@example.com $response = $this->lostController->email('test@example.com'); -- cgit v1.2.3