Add unit test for checking that status has the correct value.

This commit is contained in:
Vedanshu Jain 2023-06-14 15:17:52 +05:30
parent 59bb1f8365
commit 02a08e9e3b
1 changed files with 16 additions and 0 deletions

View File

@ -2132,4 +2132,20 @@ class OrdersTableDataStoreTests extends WC_Unit_Test_Case {
$this->assertEquals( 1, $result ); $this->assertEquals( 1, $result );
} }
/**
* @testDox When saving an order, status is automatically prefixed even if it was not earlier.
*/
public function test_get_db_row_from_order_only_prefixed_status_is_written_to_db() {
$order = wc_create_order();
$order->set_status( 'completed' );
$db_row_callback = function ( $order, $only_changes ) {
return $this->get_db_row_from_order( $order, $this->order_column_mapping, $only_changes );
};
$db_row = $db_row_callback->call( $this->sut, $order, false );
$this->assertEquals( 'wc-completed', $db_row['data']['status'] );
}
} }