Changeset 61373
- Timestamp:
- 12/12/2025 09:36:52 PM (8 hours ago)
- Location:
- trunk/tests/phpunit/tests/rest-api
- Files:
-
- 3 edited
-
wpRestAbilitiesV1CategoriesController.php (modified) (6 diffs)
-
wpRestAbilitiesV1ListController.php (modified) (7 diffs)
-
wpRestAbilitiesV1RunController.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/wpRestAbilitiesV1CategoriesController.php
r61130 r61373 172 172 173 173 $data = $response->get_data(); 174 $this->assert Equals( 'test-data-retrieval', $data['slug'] );175 $this->assert Equals( 'Data Retrieval', $data['label'] );176 $this->assert Equals( 'Abilities that retrieve and return data from the WordPress site.', $data['description'] );174 $this->assertSame( 'test-data-retrieval', $data['slug'] ); 175 $this->assertSame( 'Data Retrieval', $data['label'] ); 176 $this->assertSame( 'Abilities that retrieve and return data from the WordPress site.', $data['description'] ); 177 177 $this->assertArrayHasKey( 'meta', $data ); 178 178 } … … 190 190 191 191 $data = $response->get_data(); 192 $this->assert Equals( 'test-communication', $data['slug'] );192 $this->assertSame( 'test-communication', $data['slug'] ); 193 193 $this->assertArrayHasKey( 'meta', $data ); 194 194 $this->assertIsArray( $data['meta'] ); 195 $this->assert Equals( 'high', $data['meta']['priority'] );195 $this->assertSame( 'high', $data['meta']['priority'] ); 196 196 } 197 197 … … 213 213 $data = $response->get_data(); 214 214 $this->assertCount( 2, $data, 'Response should only contain the requested fields.' ); 215 $this->assert Equals( 'test-data-retrieval', $data['slug'] );216 $this->assert Equals( 'Data Retrieval', $data['label'] );215 $this->assertSame( 'test-data-retrieval', $data['slug'] ); 216 $this->assertSame( 'Data Retrieval', $data['label'] ); 217 217 } 218 218 … … 231 231 232 232 $data = $response->get_data(); 233 $this->assert Equals( 'rest_ability_category_not_found', $data['code'] );233 $this->assertSame( 'rest_ability_category_not_found', $data['code'] ); 234 234 } 235 235 … … 425 425 $schema = $data['schema']; 426 426 427 $this->assert Equals( 'ability-category', $schema['title'] );428 $this->assert Equals( 'object', $schema['type'] );427 $this->assertSame( 'ability-category', $schema['title'] ); 428 $this->assertSame( 'object', $schema['type'] ); 429 429 $this->assertArrayHasKey( 'properties', $schema ); 430 430 … … 439 439 440 440 $slug_property = $properties['slug']; 441 $this->assert Equals( 'string', $slug_property['type'] );441 $this->assertSame( 'string', $slug_property['type'] ); 442 442 $this->assertTrue( $slug_property['readonly'] ); 443 443 } -
trunk/tests/phpunit/tests/rest-api/wpRestAbilitiesV1ListController.php
r61130 r61373 308 308 $data = $response->get_data(); 309 309 $this->assertCount( 7, $data, 'Response should contain all fields.' ); 310 $this->assert Equals( 'test/calculator', $data['name'] );311 $this->assert Equals( 'Calculator', $data['label'] );312 $this->assert Equals( 'Performs basic calculations', $data['description'] );313 $this->assert Equals( 'math', $data['category'] );310 $this->assertSame( 'test/calculator', $data['name'] ); 311 $this->assertSame( 'Calculator', $data['label'] ); 312 $this->assertSame( 'Performs basic calculations', $data['description'] ); 313 $this->assertSame( 'math', $data['category'] ); 314 314 $this->assertArrayHasKey( 'input_schema', $data ); 315 315 $this->assertArrayHasKey( 'output_schema', $data ); … … 335 335 $data = $response->get_data(); 336 336 $this->assertCount( 2, $data, 'Response should only contain the requested fields.' ); 337 $this->assert Equals( 'test/calculator', $data['name'] );338 $this->assert Equals( 'Calculator', $data['label'] );337 $this->assertSame( 'test/calculator', $data['name'] ); 338 $this->assertSame( 'Calculator', $data['label'] ); 339 339 } 340 340 … … 356 356 $data = $response->get_data(); 357 357 $this->assertCount( 3, $data, 'Response should only contain the fields for embed context.' ); 358 $this->assert Equals( 'test/calculator', $data['name'] );359 $this->assert Equals( 'Calculator', $data['label'] );360 $this->assert Equals( 'math', $data['category'] );358 $this->assertSame( 'test/calculator', $data['name'] ); 359 $this->assertSame( 'Calculator', $data['label'] ); 360 $this->assertSame( 'math', $data['category'] ); 361 361 } 362 362 … … 375 375 376 376 $data = $response->get_data(); 377 $this->assert Equals( 'rest_ability_not_found', $data['code'] );377 $this->assertSame( 'rest_ability_not_found', $data['code'] ); 378 378 } 379 379 … … 390 390 391 391 $data = $response->get_data(); 392 $this->assert Equals( 'rest_ability_not_found', $data['code'] );392 $this->assertSame( 'rest_ability_not_found', $data['code'] ); 393 393 } 394 394 … … 582 582 $schema = $data['schema']; 583 583 584 $this->assert Equals( 'ability', $schema['title'] );585 $this->assert Equals( 'object', $schema['type'] );584 $this->assertSame( 'ability', $schema['title'] ); 585 $this->assertSame( 'object', $schema['type'] ); 586 586 $this->assertArrayHasKey( 'properties', $schema ); 587 587 … … 746 746 // Should only have math category abilities 747 747 foreach ( $data as $ability ) { 748 $this->assert Equals( 'math', $ability['category'], 'All abilities should be in math category' );748 $this->assertSame( 'math', $ability['category'], 'All abilities should be in math category' ); 749 749 } 750 750 -
trunk/tests/phpunit/tests/rest-api/wpRestAbilitiesV1RunController.php
r61130 r61373 473 473 474 474 $this->assertEquals( 200, $response->get_status() ); 475 $this->assert Equals( 'User successfully deleted!', $response->get_data() );475 $this->assertSame( 'User successfully deleted!', $response->get_data() ); 476 476 } 477 477 … … 631 631 $response = $this->server->dispatch( $request ); 632 632 $this->assertEquals( 200, $response->get_status() ); 633 $this->assert Equals( 'Success: test data', $response->get_data() );633 $this->assertSame( 'Success: test data', $response->get_data() ); 634 634 } 635 635 … … 647 647 $this->assertEquals( 404, $response->get_status() ); 648 648 $data = $response->get_data(); 649 $this->assert Equals( 'rest_ability_not_found', $data['code'] );650 $this->assert Equals( 'Ability not found.', $data['message'] );649 $this->assertSame( 'rest_ability_not_found', $data['code'] ); 650 $this->assertSame( 'Ability not found.', $data['message'] ); 651 651 } 652 652 … … 680 680 $this->assertEquals( 500, $response->get_status() ); 681 681 $data = $response->get_data(); 682 $this->assert Equals( 'test_error', $data['code'] );683 $this->assert Equals( 'This is a test error', $data['message'] );682 $this->assertSame( 'test_error', $data['code'] ); 683 $this->assertSame( 'This is a test error', $data['message'] ); 684 684 } 685 685 … … 699 699 $this->assertEquals( 404, $response->get_status() ); 700 700 $data = $response->get_data(); 701 $this->assert Equals( 'rest_ability_not_found', $data['code'] );701 $this->assertSame( 'rest_ability_not_found', $data['code'] ); 702 702 } 703 703 … … 715 715 $schema = $data['schema']; 716 716 717 $this->assert Equals( 'ability-execution', $schema['title'] );718 $this->assert Equals( 'object', $schema['type'] );717 $this->assertSame( 'ability-execution', $schema['title'] ); 718 $this->assertSame( 'object', $schema['type'] ); 719 719 $this->assertArrayHasKey( 'properties', $schema ); 720 720 $this->assertArrayHasKey( 'result', $schema['properties'] ); … … 762 762 763 763 $data = $response->get_data(); 764 $this->assert Equals( 'nested', $data['level1']['level2']['value'] );764 $this->assertSame( 'nested', $data['level1']['level2']['value'] ); 765 765 $this->assertEquals( array( 1, 2, 3 ), $data['array'] ); 766 766 }
Note: See TracChangeset
for help on using the changeset viewer.