Fix behat test to get the correct error message

pull/3924/head
Julio Montoya 4 years ago
parent 3338cec09c
commit bb15d1286a
  1. 6
      src/CoreBundle/EventListener/CourseListener.php
  2. 4
      tests/behat/features/sessionAccess.feature
  3. 16
      tests/behat/features/toolGroup.feature

@ -143,7 +143,7 @@ class CourseListener
// See CourseVoter.php
//dump("Checkisgranted");
if (false === $checker->isGranted(CourseVoter::VIEW, $course)) {
throw new AccessDeniedException($translator->trans('Unauthorised access to course!'));
throw new AccessDeniedException($translator->trans('You\'re not allowed in this course'));
}
} else {
//dump("Load chamilo session from DB");
@ -157,7 +157,7 @@ class CourseListener
// Check if user is allowed to this course-session
// See SessionVoter.php
if (false === $checker->isGranted(SessionVoter::VIEW, $session)) {
throw new AccessDeniedException($translator->trans('Unauthorised access to session!'));
throw new AccessDeniedException($translator->trans('You\'re not allowed in this session'));
}
$sessionHandler->set('session_name', $session->getName());
$sessionHandler->set('sid', $session->getId());
@ -183,7 +183,7 @@ class CourseListener
}
if (false === $checker->isGranted(GroupVoter::VIEW, $group)) {
throw new AccessDeniedException($translator->trans('Unauthorised access to group'));
throw new AccessDeniedException($translator->trans('You\'re not allowed in this group'));
}
$sessionHandler->set('gid', $groupId);

@ -65,7 +65,7 @@ Feature: Session access
Given I am logged as "ywarnier"
Then I am on course "TEMPPRIVATE" homepage in session "Session2"
And wait the page to be loaded when ready
Then I should see "Unauthorised access"
Then I should see "not allowed"
Scenario: ywarnier connect to course TEMPPRIVATE inside a session that doesn't exists
Given I am not logged
@ -79,7 +79,7 @@ Feature: Session access
Given I am logged as "mmosquera"
Then I am on course "TEMPPRIVATE" homepage in session "Session1"
And wait the page to be loaded when ready
Then I should see "Unauthorised access"
Then I should see "not allowed"
Scenario: mmosquera connect to Session 2
Given I am not logged

@ -396,11 +396,11 @@ Feature: Group tool
And I should see "Group 0003"
And I should see "Group 0004"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Exception"
Then I should see "not allowed"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should not see "Exception"
Then I should not see "not allowed"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should not see "Exception"
Then I should not see "not allowed"
Given I am not logged
Given I am logged as "acostea"
@ -413,12 +413,12 @@ Feature: Group tool
And I should see "Group 0005"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Exception"
Then I should see "not allowed"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should not see "Exception"
Then I should not see "not allowed"
Then I visit URL saved with name "announcement_for_user_fapple_group_0003_private"
Then I should see "Exception"
Then I should see "not allowed"
Then I visit URL saved with name "announcement_for_all_users_group_0003_private"
Then I should see "Exception"
Then I should see "not allowed"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should not see "Exception"
Then I should not see "not allowed"
Loading…
Cancel
Save