From 662dbab789249ec17990d0946164b4245e103cfb Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Fri, 13 Dec 2024 17:00:48 +0100 Subject: [PATCH] Add test for user with no permission --- tests/event/event-form-handler.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/event/event-form-handler.php b/tests/event/event-form-handler.php index 790ea7f1..c8753615 100644 --- a/tests/event/event-form-handler.php +++ b/tests/event/event-form-handler.php @@ -42,4 +42,20 @@ public function test_form_name_is_invalid() { $this->assertEquals( 'Invalid form name.', $response->get_error_message() ); } + + public function test_invalid_permissions() { + + $form_data = $this->event_form_handler_factory->future_inactive_event_form_data( 'create_event', $this->now ); + $response = $this->event_form_handler->process_form( $form_data ); + $this->assertEquals( 'You do not have permissions to create events.', $response->get_error_message() ); + + $form_data = $this->event_form_handler_factory->future_inactive_event_form_data( 'edit_event', $this->now ); + $response = $this->event_form_handler->process_form( $form_data ); + $this->assertEquals( 'You do not have permissions to edit this event.', $response->get_error_message() ); + + $form_data = $this->event_form_handler_factory->future_inactive_event_form_data( 'trash_event', $this->now ); + $response = $this->event_form_handler->process_form( $form_data ); + $this->assertEquals( 'You do not have permissions to delete this event.', $response->get_error_message() ); + } } +