mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-04-26 14:24:52 +02:00
fix deprecated usage of phpunit annotations
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
47a257fc90
commit
098a96ded5
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace OCA\User_SAML\Tests\Controller;
|
||||
|
||||
use Exception;
|
||||
use OCA\User_SAML\Controller\SAMLController;
|
||||
use OCA\User_SAML\Exceptions\NoUserFoundException;
|
||||
use OCA\User_SAML\SAMLSettings;
|
||||
|
@ -114,16 +115,16 @@ class SAMLControllerTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedExceptionMessage Type of "UnknownValue" is not supported for user_saml
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testLoginWithInvalidAppValue() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getAppValue')
|
||||
->with('user_saml', 'type')
|
||||
->willReturn('UnknownValue');
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Type of "UnknownValue" is not supported for user_saml');
|
||||
|
||||
$this->samlController->login(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace OCA\User_SAML\Tests\Middleware;
|
||||
|
||||
use Exception;
|
||||
use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
|
@ -79,10 +80,6 @@ class OnlyLoggedInMiddlewareTest extends \Test\TestCase {
|
|||
$this->onlyLoggedInMiddleware->beforeController($this->createMock(Controller::class), 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage User is already logged-in
|
||||
*/
|
||||
public function testBeforeControllerWithAnnotationAndLoggedIn() {
|
||||
$this->reflector
|
||||
->expects($this->once())
|
||||
|
@ -94,15 +91,19 @@ class OnlyLoggedInMiddlewareTest extends \Test\TestCase {
|
|||
->method('isLoggedIn')
|
||||
->willReturn(true);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('User is already logged-in');
|
||||
|
||||
$this->onlyLoggedInMiddleware->beforeController($this->createMock(Controller::class), 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage My Exception
|
||||
*/
|
||||
public function testAfterExceptionWithNormalException() {
|
||||
$exception = new \Exception('My Exception');
|
||||
$exceptionMsg = 'My Exception';
|
||||
$exception = new Exception($exceptionMsg);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage($exceptionMsg);
|
||||
|
||||
$this->onlyLoggedInMiddleware->afterException($this->createMock(Controller::class), 'bar', $exception);
|
||||
}
|
||||
|
||||
|
@ -113,7 +114,7 @@ class OnlyLoggedInMiddlewareTest extends \Test\TestCase {
|
|||
->with('/')
|
||||
->willReturn($homeUrl);
|
||||
|
||||
$exception = new \Exception('User is already logged-in');
|
||||
$exception = new Exception('User is already logged-in');
|
||||
$expected = new RedirectResponse($homeUrl);
|
||||
$this->assertEquals($expected, $this->onlyLoggedInMiddleware->afterException($this->createMock(Controller::class), 'bar', $exception));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue