Skip to content

Commit

Permalink
Add a snoozed note to test data.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffstieler committed Mar 20, 2019
1 parent d298f8f commit e59a3d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/api/admin-notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function test_get_notes() {
$notes = $response->get_data();

$this->assertEquals( 200, $response->get_status() );
$this->assertEquals( 2, count( $notes ) );
$this->assertEquals( 3, count( $notes ) );
}

/**
Expand Down Expand Up @@ -200,7 +200,7 @@ public function test_get_actioned_notes() {
$notes = $response->get_data();

// get_notes returns all results since 'status' is not one of actioned or unactioned.
$this->assertEquals( 2, count( $notes ) );
$this->assertEquals( 3, count( $notes ) );
}

/**
Expand All @@ -226,7 +226,7 @@ public function test_get_notes_schema() {
$data = $response->get_data();
$properties = $data['schema']['properties'];

$this->assertEquals( 15, count( $properties ) );
$this->assertEquals( 16, count( $properties ) );

$this->assertArrayHasKey( 'id', $properties );
$this->assertArrayHasKey( 'name', $properties );
Expand All @@ -245,5 +245,6 @@ public function test_get_notes_schema() {
$this->assertArrayHasKey( 'date_reminder', $properties );
$this->assertArrayHasKey( 'date_reminder_gmt', $properties );
$this->assertArrayHasKey( 'actions', $properties );
$this->assertArrayHasKey( 'is_snoozable', $properties );
}
}
13 changes: 13 additions & 0 deletions tests/framework/helpers/class-wc-helper-admin-notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,18 @@ public static function add_notes_for_tests() {
// This note has no actions.
$note_2->save();

$note_3 = new WC_Admin_Note();
$note_3->set_title( 'PHPUNIT_TEST_NOTE_3_TITLE' );
$note_3->set_content( 'PHPUNIT_TEST_NOTE_3_CONTENT' );
$note_3->set_content_data( (object) array( 'amount' => 7.89 ) );
$note_3->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note_3->set_icon( 'info' );
$note_3->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note_3->set_source( 'PHPUNIT_TEST' );
$note_3->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_SNOOZED );
$note_3->set_date_reminder( time() - HOUR_IN_SECONDS );
// This note has no actions.
$note_3->save();

}
}

0 comments on commit e59a3d3

Please sign in to comment.