Changeset 52080 for trunk/tests/phpunit/tests/rest-api/rest-server.php
- Timestamp:
- 11/09/2021 08:36:37 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-server.php
r52068 r52080 11 11 */ 12 12 class Tests_REST_Server extends WP_Test_REST_TestCase { 13 protected static $icon_id; 14 15 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 16 $filename = DIR_TESTDATA . '/images/test-image-large.jpg'; 17 self::$icon_id = $factory->attachment->create_upload_object( $filename ); 18 } 19 13 20 public function set_up() { 14 21 parent::set_up(); … … 1008 1015 $this->assertArrayHasKey( 'help', $index->get_links() ); 1009 1016 $this->assertArrayNotHasKey( 'wp:active-theme', $index->get_links() ); 1017 1018 // Check site icon. 1019 $this->assertArrayHasKey( 'site_icon', $data ); 1020 } 1021 1022 /** 1023 * @ticket 52321 1024 */ 1025 public function test_get_index_with_site_icon() { 1026 $server = new WP_REST_Server(); 1027 update_option( 'site_icon', self::$icon_id ); 1028 1029 $request = new WP_REST_Request( 'GET', '/' ); 1030 $index = $server->dispatch( $request ); 1031 $data = $index->get_data(); 1032 1033 $this->assertArrayHasKey( 'site_icon', $data ); 1034 $this->assertEquals( self::$icon_id, $data['site_icon'] ); 1010 1035 } 1011 1036
Note: See TracChangeset
for help on using the changeset viewer.