Skip to content

Commit

Permalink
Update test-anniversary.php
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk authored Dec 17, 2024
1 parent c372654 commit f64d0c0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test-anniversary.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Anniversary_Test extends Base_Test {
*/
public function anniversary_data_provider() {
return array(
'today' => array( time(), 0 ),
'1 years ago' => array( strtotime( '-1 year' ), 1 ),
'1.5 years ago' => array( strtotime( '-1.5 year' ), 0 ),
'2 years ago' => array( strtotime( '-2 year' ), 1 ),
'today' => array( time(), 0, 0 ),
'1 years ago' => array( strtotime( '-1 year' ), 1, 1 ),
'1.5 years ago' => array( strtotime( '-1.5 year' ), 0, 0 ),
'2 years ago' => array( strtotime( '-2 year' ), 1, 1 ),
);
}

Expand All @@ -33,7 +33,7 @@ public function anniversary_data_provider() {
* @param int $date The date to test.
* @param int $expected The expected number of calls to the mock action.
*/
public function test_anniversary( $date, $expected ) {
public function test_anniversary( $date, $expected, $expected_summary ) {

$user = $this->factory->user->create();

Expand All @@ -51,9 +51,11 @@ public function test_anniversary( $date, $expected ) {

$mock = new \MockAction();
add_action( 'wporg_translate_notification_anniversary', array( $mock, 'action' ), 10, 2 );
add_action( 'wporg_translate_notification_summary_anniversary', array( $mock, 'action' ) );

$anniversary();

$this->assertEquals( $expected, $mock->get_call_count() );
$this->assertEquals( $expected, $mock->get_call_count('wporg_translate_notification_anniversary') );

Check failure on line 58 in tests/test-anniversary.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 58 in tests/test-anniversary.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 spaces before closing parenthesis; 0 found
$this->assertEquals( $expected_summary, $mock->get_call_count('wporg_translate_notification_summary_anniversary') );

Check failure on line 59 in tests/test-anniversary.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 59 in tests/test-anniversary.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 spaces before closing parenthesis; 0 found
}
}

0 comments on commit f64d0c0

Please sign in to comment.