|
@@ 161-171 (lines=11) @@
|
| 158 |
|
/** |
| 159 |
|
* The pre-connection JITMs are added using the `jetpack_pre_connection_jitms` filter. |
| 160 |
|
*/ |
| 161 |
|
public function test_get_messages_return_message() { |
| 162 |
|
$this->set_prompt_helpers_and_user_cap_conditions(); |
| 163 |
|
|
| 164 |
|
Filters\expectApplied( 'jetpack_pre_connection_jitms' ) |
| 165 |
|
->once() |
| 166 |
|
->with( array() ) |
| 167 |
|
->andReturn( $this->test_jitms ); |
| 168 |
|
|
| 169 |
|
$messages = $this->jitm_instance->get_messages( '/wp:plugins:admin_notices/', '', false ); |
| 170 |
|
$this->assertSame( $this->test_jitms[0]['id'], $messages[0]->id ); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
/** |
| 174 |
|
* A pre-connection JITM is only displayed if its message_path value matches the message path |
|
@@ 193-204 (lines=12) @@
|
| 190 |
|
* The pre-connection JITM is not displayed if the message array is missing a required key. In this test, the JITM is |
| 191 |
|
* missing the message_path key. |
| 192 |
|
*/ |
| 193 |
|
public function test_get_messages_missing_key() { |
| 194 |
|
$this->set_prompt_helpers_and_user_cap_conditions(); |
| 195 |
|
|
| 196 |
|
unset( $this->test_jitms[0]['message_path'] ); |
| 197 |
|
|
| 198 |
|
Filters\expectApplied( 'jetpack_pre_connection_jitms' ) |
| 199 |
|
->once() |
| 200 |
|
->with( array() ) |
| 201 |
|
->andReturn( $this->test_jitms ); |
| 202 |
|
|
| 203 |
|
$this->assertEmpty( $this->jitm_instance->get_messages( '/wp:plugins:admin_notices/', '', false ) ); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
/** |
| 207 |
|
* A pre-connection JITM is displayed if it has unexpected keys. |