\BuoyAlertsTest

Buoy alerts testing class.

We use PHPUnit's @ticket annotation to refer to GitHub issues, but still want to use WP_UnitTestCase for its various factory methods, so we subclass it and stub out the Trac-checking part. :)

Summary

Methods
Properties
Constants
setUp()
test_alert_post_type_exists()
test_unknown_alert_throws_exception()
test_setting_up_new_alert_creates_chat_room_name()
test_new_alert_created()
test_get_alert_with_at_least_8_character_string()
test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation()
test_deleteOldAlerts()
test_addIncidentResponder()
test_canOnlyAddSameIncidentResponderOnce()
test_getIncidentResponders()
test_getResponderGeoLocation()
test_go_to_my_location_references_current_user_id()
No public properties found
No constants found
checkRequirements()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

setUp()

setUp() 

Sets up the testing environment before each test.

test_alert_post_type_exists()

test_alert_post_type_exists() 

Ensures that WordPress recognizes what a "Buoy Alert" is.

test_unknown_alert_throws_exception()

test_unknown_alert_throws_exception() 

Asking for a non-existent alert should throw an Exception.

test_setting_up_new_alert_creates_chat_room_name()

test_setting_up_new_alert_creates_chat_room_name() 

test_new_alert_created()

test_new_alert_created() 

test_get_alert_with_at_least_8_character_string()

test_get_alert_with_at_least_8_character_string() 

test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation()

test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation() 

Checks (de)activating the plugin (un)schedules "old" alerts for deletion.

It is important for Buoy alerts to be ephemeral in nature, not necessarily stored in a database for a long time. This test is used to make sure that merely activating the plugin is enough to tell the plugin to delete any incident data that was made 48 hours ago (or longer).

This test also checks for the inverse: that this scheduled job is automatically removed whenever the plugin is deactivated.

Note that this test does not ensure the alert data itself is deleted, only that the automatic job scheduler has the correct information.

test_deleteOldAlerts()

test_deleteOldAlerts() 

test_addIncidentResponder()

test_addIncidentResponder() 

test_canOnlyAddSameIncidentResponderOnce()

test_canOnlyAddSameIncidentResponderOnce() 

test_getIncidentResponders()

test_getIncidentResponders() 

test_getResponderGeoLocation()

test_getResponderGeoLocation() 

test_go_to_my_location_references_current_user_id()

test_go_to_my_location_references_current_user_id() 

Ensures that the "Go to my location" button refers to the current user.

checkRequirements()

checkRequirements() : void

Empty method to disable integration with WP Core Trac.

Overrides the parent's method to disable fetching information from the WordPress Core Trac ticket tracker which causes tests with the @ticket annotation in our own test cases to fail.