Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Created October 15, 2015 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdunogier/8b3bfcd4fdc49e7c0dc2 to your computer and use it in GitHub Desktop.
Save bdunogier/8b3bfcd4fdc49e7c0dc2 to your computer and use it in GitHub Desktop.
Testing application exception handling with Behat
Feature: Handling of Unauthorized repository exceptions
Scenario: When a Repository UnauthorizedException is throw, anonymous users are shown the login screen # vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Features/Exception/unauthorized_login_form.feature:2
Given that I am not logged in # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::iAmNotLoggedIn()
When a repository UnauthorizedException is thrown during an HTTP request # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::anExceptionIsThrownDuringAnHTTPRequest()
Then the login form is shown # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::theLoginFormIsShown()
Scenario: When a Repository UnauthorizedException is throw, authenticated users are shown the exception # vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Features/Exception/unauthorized_login_form.feature:7
Given that I am logged in # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::iAmLoggedIn()
When a repository UnauthorizedException is thrown during an HTTP request # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::anExceptionIsThrownDuringAnHTTPRequest()
Then an eZ\Publish\Core\Base\Exceptions\UnauthorizedException is displayed # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::anAccessDeniedExceptionIsThrown()
And an Symfony\Component\Security\Core\Exception\AccessDeniedException is displayed # eZ\Bundle\EzPublishCoreBundle\Features\Context\ExceptionContext::anAccessDeniedExceptionIsThrown()
2 scénarios (2 succès)
7 étapes (7 succès)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment