Clean-up.

This commit is contained in:
barryhughes 2022-02-15 05:52:30 -08:00
parent a7c98d5f58
commit 18fa388ed9
3 changed files with 8 additions and 9 deletions

View File

@ -147,7 +147,7 @@ class WC_REST_Product_Reviews_V1_Controller_Tests extends WC_Unit_Test_Case {
$this->assertEquals( $this->assertEquals(
'woocommerce_rest_cannot_delete', 'woocommerce_rest_cannot_delete',
$this->sut->delete_item_permissions_check( $request )->get_error_code(), $this->sut->delete_item_permissions_check( $request )->get_error_code(),
'Comments that are not product reviews (including other types of comments belonging to prodcuts) cannot be deleted via this endpoint.' 'Comments that are not product reviews (including other types of comments belonging to products) cannot be deleted via this endpoint.'
); );
} }
} }

View File

@ -30,9 +30,8 @@ class WC_REST_Product_Reviews_V2_Controller_Test extends WC_REST_Unit_Test_case
/** /**
* @testdox Ensure attempts to modify product reviews (via batches) are subject to appropriate permission checks. * @testdox Ensure attempts to modify product reviews (via batches) are subject to appropriate permission checks.
*/ */
public function test_permissions_for_deleting_product_reviews() { public function test_permissions_for_batch_product_reviews() {
$request = new WP_REST_Request( 'POST', '/wc/v2/products/123/reviews/batch' ); $request = new WP_REST_Request( 'POST', '/wc/v2/products/123/reviews/batch' );
$request->set_param( 'id', $this->review_id );
wp_set_current_user( $this->editor_id ); wp_set_current_user( $this->editor_id );
$this->assertEquals( $this->assertEquals(

View File

@ -2,11 +2,12 @@
/** /**
* Tests relating to the Product Reviews controller in APIv2. * Tests relating to the Product Reviews controller in APIv3.
*/ */
class WC_REST_Product_Reviews_Controller_Tests extends WC_REST_Unit_Test_Case { class WC_REST_Product_Reviews_Controller_Tests extends WC_REST_Unit_Test_Case {
/** /**
* @var WC_REST_Product_Reviews_V2_Controller * @var WC_REST_Product_Reviews_Controller
* @var WC_REST_Product_Reviews_Controller
*/ */
private $sut; private $sut;
@ -23,7 +24,7 @@ class WC_REST_Product_Reviews_Controller_Tests extends WC_REST_Unit_Test_Case {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->sut = new WC_REST_Product_Reviews_V2_Controller(); $this->sut = new WC_REST_Product_Reviews_Controller();
$this->shop_manager_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); $this->shop_manager_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
$this->editor_id = self::factory()->user->create( array( 'role' => 'editor' ) ); $this->editor_id = self::factory()->user->create( array( 'role' => 'editor' ) );
} }
@ -31,9 +32,8 @@ class WC_REST_Product_Reviews_Controller_Tests extends WC_REST_Unit_Test_Case {
/** /**
* @testdox Ensure attempts to modify product reviews (via batches) are subject to appropriate permission checks. * @testdox Ensure attempts to modify product reviews (via batches) are subject to appropriate permission checks.
*/ */
public function test_permissions_for_deleting_product_reviews() { public function test_permissions_for_batch_product_reviews() {
$request = new WP_REST_Request( 'POST', '/wc/v2/products/123/reviews/batch' ); $request = new WP_REST_Request( 'POST', '/wc/v3/products/reviews/batch' );
$request->set_param( 'id', $this->review_id );
wp_set_current_user( $this->editor_id ); wp_set_current_user( $this->editor_id );
$this->assertEquals( $this->assertEquals(