Add test coverage for shipping zone schema endpoint.

This commit is contained in:
Jeff Stieler 2016-06-14 16:57:35 -06:00 committed by Justin Shreve
parent e4ccede35f
commit 3492f397d4
1 changed files with 18 additions and 0 deletions

View File

@ -136,4 +136,22 @@ class WC_Tests_API_Shipping_Zones extends WC_Unit_Test_Case {
remove_filter( 'wc_shipping_enabled', '__return_false' );
}
/**
* Test Shipping Zone schema.
* @since 2.7.0
*/
public function test_get_shipping_zone_schema() {
$request = new WP_REST_Request( 'OPTIONS', '/wc/v1/shipping/zones' );
$response = $this->server->dispatch( $request );
$data = $response->get_data();
$properties = $data['schema']['properties'];
$this->assertEquals( 3, count( $properties ) );
$this->assertArrayHasKey( 'id', $properties );
$this->assertTrue( $properties['id']['readonly'] );
$this->assertArrayHasKey( 'name', $properties );
$this->assertTrue( $properties['name']['required'] );
$this->assertArrayHasKey( 'order', $properties );
$this->assertFalse( $properties['order']['required'] );
}
}