- Timestamp:
- 07/07/2021 10:32:56 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r51331 r51367 388 388 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 389 389 $response = rest_get_server()->dispatch( $request ); 390 $this->assert Same( 10, count( $response->get_data()) );390 $this->assertCount( 10, $response->get_data() ); 391 391 392 392 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 393 393 $request->set_param( 'per_page', 5 ); 394 394 $response = rest_get_server()->dispatch( $request ); 395 $this->assert Same( 5, count( $response->get_data()) );395 $this->assertCount( 5, $response->get_data() ); 396 396 } 397 397 … … 403 403 $request->set_param( 'page', 2 ); 404 404 $response = rest_get_server()->dispatch( $request ); 405 $this->assert Same( 5, count( $response->get_data()) );405 $this->assertCount( 5, $response->get_data() ); 406 406 $prev_link = add_query_arg( 407 407 array( … … 599 599 $response = rest_get_server()->dispatch( $request ); 600 600 $data = $response->get_data(); 601 $this->assert Same( 2, count( $data ));601 $this->assertCount( 2, $data ); 602 602 $this->assertSame( $id1, $data[0]['id'] ); 603 603 … … 606 606 $response = rest_get_server()->dispatch( $request ); 607 607 $data = $response->get_data(); 608 $this->assert Same( 2, count( $data ));608 $this->assertCount( 2, $data ); 609 609 $this->assertSame( $id2, $data[0]['id'] ); 610 610 … … 619 619 $response = rest_get_server()->dispatch( $request ); 620 620 $data = $response->get_data(); 621 $this->assert Same( 0, count( $data ));621 $this->assertCount( 0, $data ); 622 622 623 623 } … … 656 656 $request->set_param( 'search', 'yololololo' ); 657 657 $response = rest_get_server()->dispatch( $request ); 658 $this->assert Same( 0, count( $response->get_data()) );658 $this->assertCount( 0, $response->get_data() ); 659 659 660 660 $yolo_id = $this->factory->user->create( array( 'display_name' => 'yololololo' ) ); … … 663 663 $request->set_param( 'search', 'yololololo' ); 664 664 $response = rest_get_server()->dispatch( $request ); 665 $this->assert Same( 1, count( $response->get_data()) );665 $this->assertCount( 1, $response->get_data() ); 666 666 // Default to wildcard search. 667 667 $adam_id = $this->factory->user->create( … … 676 676 $response = rest_get_server()->dispatch( $request ); 677 677 $data = $response->get_data(); 678 $this->assert Same( 1, count( $data ));678 $this->assertCount( 1, $data ); 679 679 $this->assertSame( $adam_id, $data[0]['id'] ); 680 680 } … … 700 700 $response = rest_get_server()->dispatch( $request ); 701 701 $data = $response->get_data(); 702 $this->assert Same( 1, count( $data ));702 $this->assertCount( 1, $data ); 703 703 $this->assertSame( $id2, $data[0]['id'] ); 704 704 } … … 813 813 $response = rest_get_server()->dispatch( $request ); 814 814 $data = $response->get_data(); 815 $this->assert Same( 3, count( $data ));815 $this->assertCount( 3, $data ); 816 816 $this->assertSame( $tango, $data[1]['id'] ); 817 817 $this->assertSame( $yolo, $data[2]['id'] ); … … 820 820 $response = rest_get_server()->dispatch( $request ); 821 821 $data = $response->get_data(); 822 $this->assert Same( 1, count( $data ));822 $this->assertCount( 1, $data ); 823 823 $this->assertSame( $yolo, $data[0]['id'] ); 824 824 … … 850 850 $response = rest_get_server()->dispatch( $request ); 851 851 $data = $response->get_data(); 852 $this->assert Same( 1, count( $data ));852 $this->assertCount( 1, $data ); 853 853 $this->assertSame( $lolz, $data[0]['id'] ); 854 854 … … 857 857 $response = rest_get_server()->dispatch( $request ); 858 858 $data = $response->get_data(); 859 $this->assert Same( 0, count( $data ));859 $this->assertCount( 0, $data ); 860 860 $this->assertSame( array(), $data ); 861 861 } … … 2621 2621 $properties = $data['schema']['properties']; 2622 2622 2623 $this->assert Same( 19, count( $properties ));2623 $this->assertCount( 19, $properties ); 2624 2624 $this->assertArrayHasKey( 'avatar_urls', $properties ); 2625 2625 $this->assertArrayHasKey( 'capabilities', $properties );
Note: See TracChangeset
for help on using the changeset viewer.