Add a snoozed note to test data.

This commit is contained in:
Jeff Stieler 2019-03-19 15:46:08 -06:00
parent 6ab3f0b9f9
commit 2a08ba20e8
2 changed files with 17 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$notes = $response->get_data();
$this->assertEquals( 200, $response->get_status() );
$this->assertEquals( 2, count( $notes ) );
$this->assertEquals( 3, count( $notes ) );
}
/**
@ -200,7 +200,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$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 ) );
}
/**
@ -226,7 +226,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$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 );
@ -245,5 +245,6 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$this->assertArrayHasKey( 'date_reminder', $properties );
$this->assertArrayHasKey( 'date_reminder_gmt', $properties );
$this->assertArrayHasKey( 'actions', $properties );
$this->assertArrayHasKey( 'is_snoozable', $properties );
}
}

View File

@ -59,5 +59,18 @@ class WC_Helper_Admin_Notes {
// 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();
}
}