|
@@ 216-238 (lines=23) @@
|
| 213 |
|
* |
| 214 |
|
* @return array |
| 215 |
|
*/ |
| 216 |
|
protected function test__blog_token_if_exists() { |
| 217 |
|
$name = __FUNCTION__; |
| 218 |
|
|
| 219 |
|
if ( ! $this->helper_is_jetpack_connected() ) { |
| 220 |
|
return self::skipped_test( |
| 221 |
|
array( |
| 222 |
|
'name' => $name, |
| 223 |
|
'short_description' => __( 'Jetpack is not connected. No blog token to check.', 'jetpack' ), |
| 224 |
|
) |
| 225 |
|
); |
| 226 |
|
} |
| 227 |
|
$blog_token = $this->helper_get_blog_token(); |
| 228 |
|
|
| 229 |
|
if ( $blog_token ) { |
| 230 |
|
$result = self::passing_test( array( 'name' => $name ) ); |
| 231 |
|
} else { |
| 232 |
|
$connection_error = __( 'Blog token is missing.', 'jetpack' ); |
| 233 |
|
|
| 234 |
|
$result = self::connection_failing_test( $name, $connection_error ); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
|
return $result; |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
/** |
| 241 |
|
* Test if Jetpack is connected. |
|
@@ 291-312 (lines=22) @@
|
| 288 |
|
* |
| 289 |
|
* @return array Test results. |
| 290 |
|
*/ |
| 291 |
|
protected function test__master_user_exists_on_site() { |
| 292 |
|
$name = __FUNCTION__; |
| 293 |
|
if ( ! $this->helper_is_jetpack_connected() ) { |
| 294 |
|
return self::skipped_test( |
| 295 |
|
array( |
| 296 |
|
'name' => $name, |
| 297 |
|
'short_description' => __( 'Jetpack is not connected. No master user to check.', 'jetpack' ), |
| 298 |
|
) |
| 299 |
|
); |
| 300 |
|
} |
| 301 |
|
$local_user = $this->helper_retrieve_local_master_user(); |
| 302 |
|
|
| 303 |
|
if ( $local_user->exists() ) { |
| 304 |
|
$result = self::passing_test( array( 'name' => $name ) ); |
| 305 |
|
} else { |
| 306 |
|
$connection_error = __( 'The user who setup the Jetpack connection no longer exists on this site.', 'jetpack' ); |
| 307 |
|
|
| 308 |
|
$result = self::connection_failing_test( $name, $connection_error ); |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
return $result; |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
/** |
| 315 |
|
* Test that the master user has the manage options capability (e.g. is an admin). |