fix phpcs
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 40s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m7s

This commit is contained in:
André Menrath 2024-10-11 19:27:12 +02:00
parent d5dcfd5e0c
commit 4263233e10
2 changed files with 18 additions and 0 deletions

View file

@ -29,6 +29,9 @@
<!-- Exclude Javascript files. --> <!-- Exclude Javascript files. -->
<exclude-pattern>*.js</exclude-pattern> <exclude-pattern>*.js</exclude-pattern>
<!-- Exclude build assets from js blocks. -->
<exclude-pattern>/build/*/*asset.php</exclude-pattern>
<!-- Exclude minified Javascript files. --> <!-- Exclude minified Javascript files. -->
<exclude-pattern>*.min.js</exclude-pattern> <exclude-pattern>*.min.js</exclude-pattern>

View file

@ -46,6 +46,9 @@ class Test_Reminder extends WP_UnitTestCase {
_delete_all_posts(); _delete_all_posts();
} }
/**
* Test that with the default reminder setting (time-gap is zero) no reminder event is scheduled.
*/
public function test_event_reminder_not_being_scheduled_by_default() { public function test_event_reminder_not_being_scheduled_by_default() {
// Create a The Events Calendar Event. // Create a The Events Calendar Event.
$wp_object = tribe_events() $wp_object = tribe_events()
@ -57,6 +60,9 @@ class Test_Reminder extends WP_UnitTestCase {
$this->assertEquals( false, $scheduled_event ); $this->assertEquals( false, $scheduled_event );
} }
/**
* Test that with a side-wide option the reminder is scheduled.
*/
public function test_event_reminder_scheduled_with_site_wide_option() { public function test_event_reminder_scheduled_with_site_wide_option() {
\update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS ); \update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS );
// Create a The Events Calendar Event. // Create a The Events Calendar Event.
@ -72,6 +78,9 @@ class Test_Reminder extends WP_UnitTestCase {
$this->assertEquals( 'activitypub_event_bridge_send_event_reminder', $scheduled_event->hook ); $this->assertEquals( 'activitypub_event_bridge_send_event_reminder', $scheduled_event->hook );
} }
/**
* Test that a specific event can override the side-wide reminder default.
*/
public function test_event_reminder_scheduled_with_per_event_override() { public function test_event_reminder_scheduled_with_per_event_override() {
\update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS ); \update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS );
@ -106,6 +115,9 @@ class Test_Reminder extends WP_UnitTestCase {
$this->assertEquals( strtotime( self::MOCKUP_EVENT['start_date'] ) - HOUR_IN_SECONDS, $scheduled_event->timestamp ); $this->assertEquals( strtotime( self::MOCKUP_EVENT['start_date'] ) - HOUR_IN_SECONDS, $scheduled_event->timestamp );
} }
/**
* Test that the scheduled reminder is removed when the event is deleted.
*/
public function test_event_reminder_deleted_event() { public function test_event_reminder_deleted_event() {
\update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS ); \update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS );
@ -133,6 +145,9 @@ class Test_Reminder extends WP_UnitTestCase {
$this->assertEquals( false, $scheduled_event ); $this->assertEquals( false, $scheduled_event );
} }
/**
* Test that the scheduled reminder is removed when the event is moved to trash.
*/
public function test_event_reminder_event_moved_to_trash() { public function test_event_reminder_event_moved_to_trash() {
\update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS ); \update_option( 'activitypub_event_bridge_reminder_time_gap', DAY_IN_SECONDS );