mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Simplified guard names and rolled out guard route checks
- Included tests to cover for LDAP and SAML - Updated wording for external auth id option. - Updated 'assertPermissionError' test case to be usable in BrowserKitTests
This commit is contained in:
@ -262,4 +262,19 @@ trait SharedTestHelpers
|
||||
self::assertThat($passed, self::isTrue(), "Failed asserting that given map:\n\n{$toCheckStr}\n\nincludes:\n\n{$toIncludeStr}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a permission error has occurred.
|
||||
*/
|
||||
protected function assertPermissionError($response)
|
||||
{
|
||||
if ($response instanceof BrowserKitTest) {
|
||||
$response = \Illuminate\Foundation\Testing\TestResponse::fromBaseResponse($response->response);
|
||||
}
|
||||
|
||||
$response->assertRedirect('/');
|
||||
$this->assertSessionHas('error');
|
||||
$error = session()->pull('error');
|
||||
$this->assertStringStartsWith('You do not have permission to access', $error);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user