Fixed failing unit tests in Version2/product-reviews

This commit is contained in:
anitaamurthy 2022-03-15 14:41:39 +05:30
parent acbb448f6b
commit c335c7322e
1 changed files with 9 additions and 1 deletions

View File

@ -56,6 +56,8 @@ class WC_Tests_API_Product_Reviews_V2 extends WC_REST_Unit_Test_Case {
'date_created' => $product_reviews[0]['date_created'], 'date_created' => $product_reviews[0]['date_created'],
'date_created_gmt' => $product_reviews[0]['date_created_gmt'], 'date_created_gmt' => $product_reviews[0]['date_created_gmt'],
'product_id' => $product->get_id(), 'product_id' => $product->get_id(),
'product_name' => $product->get_name(),
'product_permalink' => $product->get_permalink(),
'status' => 'approved', 'status' => 'approved',
'reviewer' => 'admin', 'reviewer' => 'admin',
'reviewer_email' => 'woo@woo.local', 'reviewer_email' => 'woo@woo.local',
@ -128,6 +130,8 @@ class WC_Tests_API_Product_Reviews_V2 extends WC_REST_Unit_Test_Case {
'date_created' => $data['date_created'], 'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'], 'date_created_gmt' => $data['date_created_gmt'],
'product_id' => $product->get_id(), 'product_id' => $product->get_id(),
'product_name' => $product->get_name(),
'product_permalink' => $product->get_permalink(),
'status' => 'approved', 'status' => 'approved',
'reviewer' => 'admin', 'reviewer' => 'admin',
'reviewer_email' => 'woo@woo.local', 'reviewer_email' => 'woo@woo.local',
@ -193,6 +197,8 @@ class WC_Tests_API_Product_Reviews_V2 extends WC_REST_Unit_Test_Case {
'date_created' => $data['date_created'], 'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'], 'date_created_gmt' => $data['date_created_gmt'],
'product_id' => $product->get_id(), 'product_id' => $product->get_id(),
'product_name' => $product->get_name(),
'product_permalink' => $product->get_permalink(),
'status' => 'approved', 'status' => 'approved',
'reviewer' => 'Admin', 'reviewer' => 'Admin',
'reviewer_email' => 'woo@woo.local', 'reviewer_email' => 'woo@woo.local',
@ -449,11 +455,13 @@ class WC_Tests_API_Product_Reviews_V2 extends WC_REST_Unit_Test_Case {
$data = $response->get_data(); $data = $response->get_data();
$properties = $data['schema']['properties']; $properties = $data['schema']['properties'];
$this->assertEquals( 11, count( $properties ) ); $this->assertEquals( 13, count( $properties ) );
$this->assertArrayHasKey( 'id', $properties ); $this->assertArrayHasKey( 'id', $properties );
$this->assertArrayHasKey( 'date_created', $properties ); $this->assertArrayHasKey( 'date_created', $properties );
$this->assertArrayHasKey( 'date_created_gmt', $properties ); $this->assertArrayHasKey( 'date_created_gmt', $properties );
$this->assertArrayHasKey( 'product_id', $properties ); $this->assertArrayHasKey( 'product_id', $properties );
$this->assertArrayHasKey( 'product_name', $properties );
$this->assertArrayHasKey( 'product_permalink', $properties );
$this->assertArrayHasKey( 'status', $properties ); $this->assertArrayHasKey( 'status', $properties );
$this->assertArrayHasKey( 'reviewer', $properties ); $this->assertArrayHasKey( 'reviewer', $properties );
$this->assertArrayHasKey( 'reviewer_email', $properties ); $this->assertArrayHasKey( 'reviewer_email', $properties );