|
@@ 121-131 (lines=11) @@
|
| 118 |
|
/** |
| 119 |
|
* The pre-connection JITMs are added using the `jetpack_pre_connection_jitms` filter. |
| 120 |
|
*/ |
| 121 |
|
public function test_get_messages_return_message() { |
| 122 |
|
$this->set_user_cap_conditions(); |
| 123 |
|
|
| 124 |
|
Filters\expectApplied( 'jetpack_pre_connection_jitms' ) |
| 125 |
|
->once() |
| 126 |
|
->with( array() ) |
| 127 |
|
->andReturn( $this->test_jitms ); |
| 128 |
|
|
| 129 |
|
$messages = $this->jitm_instance->get_messages( '/wp:plugins:admin_notices/', '', false ); |
| 130 |
|
$this->assertSame( $this->test_jitms[0]['id'], $messages[0]->id ); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
/** |
| 134 |
|
* A pre-connection JITM is only displayed if its message_path value matches the message path |
|
@@ 153-164 (lines=12) @@
|
| 150 |
|
* The pre-connection JITM is not displayed if the message array is missing a required key. In this test, the JITM is |
| 151 |
|
* missing the message_path key. |
| 152 |
|
*/ |
| 153 |
|
public function test_get_messages_missing_key() { |
| 154 |
|
$this->set_user_cap_conditions(); |
| 155 |
|
|
| 156 |
|
unset( $this->test_jitms[0]['message_path'] ); |
| 157 |
|
|
| 158 |
|
Filters\expectApplied( 'jetpack_pre_connection_jitms' ) |
| 159 |
|
->once() |
| 160 |
|
->with( array() ) |
| 161 |
|
->andReturn( $this->test_jitms ); |
| 162 |
|
|
| 163 |
|
$this->assertEmpty( $this->jitm_instance->get_messages( '/wp:plugins:admin_notices/', '', false ) ); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
/** |
| 167 |
|
* A pre-connection JITM is displayed if it has unexpected keys. |