get_routes(); $namespace = '/wc/store/v1'; $test_paths = array( '/batch', '/cart', '/cart/add-item', '/cart/apply-coupon', '/cart/coupons', '/cart/coupons/(?P[\w-]+)', '/cart/extensions', '/cart/items', '/cart/items/(?P[\w-]{32})', '/cart/remove-coupon', '/cart/remove-item', '/cart/select-shipping-rate', '/cart/update-customer', '/cart/update-item', '/checkout', '/products/attributes', '/products/attributes/(?P[\d]+)', '/products/attributes/(?P[\d]+)/terms', '/products/categories', '/products/categories/(?P[\d]+)', '/products/collection-data', '/products/reviews', '/products', '/products/(?P[\d]+)', '/products/tags', ); foreach ( $test_paths as $test_path ) { $this->assertArrayHasKey( $namespace . $test_path, $routes ); } } /** * Test unversioned route registration. */ public function test_unversioned_routes() { $routes = rest_get_server()->get_routes(); $namespace = '/wc/store/v1'; $test_paths = array( '/batch', '/cart', '/cart/add-item', '/cart/apply-coupon', '/cart/coupons', '/cart/coupons/(?P[\w-]+)', '/cart/extensions', '/cart/items', '/cart/items/(?P[\w-]{32})', '/cart/remove-coupon', '/cart/remove-item', '/cart/select-shipping-rate', '/cart/update-customer', '/cart/update-item', '/checkout', '/products/attributes', '/products/attributes/(?P[\d]+)', '/products/attributes/(?P[\d]+)/terms', '/products/categories', '/products/categories/(?P[\d]+)', '/products/collection-data', '/products/reviews', '/products', '/products/(?P[\d]+)', '/products/tags', ); foreach ( $test_paths as $test_path ) { $this->assertArrayHasKey( $namespace . $test_path, $routes ); } } }