Skip to content

Commit

Permalink
Add test for user with no permission
Browse files Browse the repository at this point in the history
  • Loading branch information
trymebytes committed Dec 13, 2024
1 parent 5717ff6 commit 662dbab
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/event/event-form-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
}

Check failure on line 60 in tests/event/event-form-handler.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 blank line at end of file; 2 found

0 comments on commit 662dbab

Please sign in to comment.