get_routes(); $this->assertArrayHasKey( '/wc/store/cart/extensions', $routes ); } /** * Test getting cart with invalid namespace. */ public function test_post() { $request = new \WP_REST_Request( 'POST', '/wc/store/cart/extensions' ); $request->set_header( 'X-WC-Store-API-Nonce', wp_create_nonce( 'wc_store_api' ) ); $request->set_body_params( array( 'namespace' => 'test-plugin', ) ); $response = rest_get_server()->dispatch( $request ); $this->assertEquals( 400, $response->get_status() ); } }