Changeset 11103
- Timestamp:
- 07/07/2021 10:14:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/patterns/1.0/tests/test-index.php
r11082 r11103 15 15 */ 16 16 public function assertResponseHasPattern( $response ) { 17 $this->assertSame( 200, $response->status_code ); 18 17 19 $patterns = json_decode( $response->body ); 18 19 $this->assertSame( 200, $response->status_code );20 20 $this->assertGreaterThan( 0, count( $patterns ) ); 21 21 $this->assertIsString( $patterns[0]->title->rendered ); … … 51 51 */ 52 52 public function test_browse_all_patterns() : void { 53 $response = send_request( '/patterns/1.0/' ); 53 $response = send_request( '/patterns/1.0/' ); 54 $this->assertResponseHasPattern( $response ); 55 54 56 $patterns = json_decode( $response->body ); 55 57 $term_slugs = $this->get_term_slugs( $patterns ); 56 57 $this->assertResponseHasPattern( $response );58 58 $this->assertGreaterThan( 1, count( $term_slugs ) ); 59 59 } … … 67 67 $button_term_id = 2; 68 68 $response = send_request( '/patterns/1.0/?pattern-categories=' . $button_term_id ); 69 $patterns = json_decode( $response->body );70 $term_slugs = $this->get_term_slugs( $patterns );71 72 69 $this->assertResponseHasPattern( $response ); 70 71 $patterns = json_decode( $response->body ); 72 $term_slugs = $this->get_term_slugs( $patterns ); 73 73 $this->assertSame( array( 'buttons' ), $term_slugs ); 74 74 } … … 98 98 99 99 $response = send_request( $query_args ); 100 101 100 $this->assertResponseHasPattern( $response ); 102 101 … … 104 103 $found_locales = array_column( $patterns, 'meta' ); 105 104 $found_locales = array_column( $found_locales, 'wpop_locale' ); 106 107 $this->assertSame( 200, $response->status_code );108 105 109 106 if ( $expected_locale ) { … … 198 195 */ 199 196 public function test_browse_all_categories() : void { 200 $response = send_request( '/patterns/1.0/?categories' ); 197 $response = send_request( '/patterns/1.0/?categories' ); 198 $this->assertSame( 200, $response->status_code ); 199 201 200 $categories = json_decode( $response->body ); 202 203 $this->assertSame( 200, $response->status_code );204 201 $this->assertGreaterThan( 0, count( $categories ) ); 205 206 202 $this->assertIsInt( $categories[0]->id ); 207 203 $this->assertIsString( $categories[0]->name );
Note: See TracChangeset
for help on using the changeset viewer.