| 120 | |
| 121 | /** |
| 122 | * @dataProvider data_get_all |
| 123 | * |
| 124 | * @ticket 40228 |
| 125 | */ |
| 126 | public function test_get_blog_details_get_object_vars( $get_all ) { |
| 127 | $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/' ), $get_all ); |
| 128 | |
| 129 | $result = array_keys( get_object_vars( $site ) ); |
| 130 | |
| 131 | $this->assertEqualSets( $this->get_fields( $get_all ), $result ); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * @dataProvider data_get_all |
| 136 | * |
| 137 | * @ticket 40228 |
| 138 | */ |
| 139 | public function test_get_blog_details_iterate_over_result( $get_all ) { |
| 140 | $site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/' ), $get_all ); |
| 141 | |
| 142 | $result = array(); |
| 143 | foreach ( $site as $key => $value ) { |
| 144 | $result[] = $key; |
| 145 | } |
| 146 | |
| 147 | $this->assertEqualSets( $this->get_fields( $get_all ), $result ); |
| 148 | } |
| 149 | |
| 150 | public function data_get_all() { |
| 151 | return array( |
| 152 | array( false ), |
| 153 | array( true ), |
| 154 | ); |
| 155 | } |
| 156 | |
| 157 | protected function get_fields( $all = false ) { |
| 158 | $fields = array( |
| 159 | 'blog_id', |
| 160 | 'domain', |
| 161 | 'path', |
| 162 | 'site_id', |
| 163 | 'registered', |
| 164 | 'last_updated', |
| 165 | 'public', |
| 166 | 'archived', |
| 167 | 'mature', |
| 168 | 'spam', |
| 169 | 'deleted', |
| 170 | 'lang_id', |
| 171 | ); |
| 172 | |
| 173 | if ( $all ) { |
| 174 | $fields = array_merge( $fields, array( |
| 175 | 'blogname', |
| 176 | 'siteurl', |
| 177 | 'post_count', |
| 178 | 'home', |
| 179 | ) ); |
| 180 | } |
| 181 | |
| 182 | return $fields; |
| 183 | } |