Notes: Type cast is_snoozeable on insert. (https://github.com/woocommerce/woocommerce-admin/pull/2573)
This commit is contained in:
parent
6da2728f99
commit
dde788631c
|
@ -31,7 +31,7 @@ class WC_Admin_Notes_Data_Store extends WC_Data_Store_WP implements WC_Object_Da
|
|||
'icon' => $note->get_icon(),
|
||||
'status' => $note->get_status(),
|
||||
'source' => $note->get_source(),
|
||||
'is_snoozable' => $note->get_is_snoozable(),
|
||||
'is_snoozable' => (int) $note->get_is_snoozable(),
|
||||
);
|
||||
|
||||
$note_to_be_inserted['content_data'] = wp_json_encode( $note->get_content_data() );
|
||||
|
|
|
@ -176,6 +176,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertEquals( 1, count( $notes ) );
|
||||
$this->assertEquals( $notes[0]['title'], 'PHPUNIT_TEST_NOTE_2_TITLE' );
|
||||
$this->assertEquals( $notes[0]['is_snoozable'], true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,6 +248,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertEquals( 3, count( $notes ) );
|
||||
$this->assertEquals( $notes[0]['title'], 'PHPUNIT_TEST_NOTE_1_TITLE' );
|
||||
$this->assertEquals( $notes[0]['is_snoozable'], false );
|
||||
$this->assertEquals( $notes[1]['title'], 'PHPUNIT_TEST_NOTE_2_TITLE' );
|
||||
$this->assertEquals( $notes[2]['title'], 'PHPUNIT_TEST_NOTE_3_TITLE' );
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class WC_Helper_Admin_Notes {
|
|||
$note_1->set_icon( 'info' );
|
||||
$note_1->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
|
||||
$note_1->set_source( 'PHPUNIT_TEST' );
|
||||
$note_1->set_is_snoozable( false );
|
||||
$note_1->add_action(
|
||||
'PHPUNIT_TEST_NOTE_1_ACTION_1_SLUG',
|
||||
'PHPUNIT_TEST_NOTE_1_ACTION_1_LABEL',
|
||||
|
@ -56,6 +57,7 @@ class WC_Helper_Admin_Notes {
|
|||
$note_2->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
|
||||
$note_2->set_source( 'PHPUNIT_TEST' );
|
||||
$note_2->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED );
|
||||
$note_2->set_is_snoozable( true );
|
||||
// This note has no actions.
|
||||
$note_2->save();
|
||||
|
||||
|
|
Loading…
Reference in New Issue