| 172 | |
| 173 | function test_in_admin() { |
| 174 | $screen = get_current_screen(); |
| 175 | |
| 176 | set_current_screen( 'edit.php' ); |
| 177 | $this->assertTrue( get_current_screen()->in_admin() ); |
| 178 | $this->assertTrue( get_current_screen()->in_admin( 'blog' ) ); |
| 179 | $this->assertFalse( get_current_screen()->in_admin( 'network' ) ); |
| 180 | $this->assertFalse( get_current_screen()->in_admin( 'user' ) ); |
| 181 | |
| 182 | set_current_screen( 'dashboard-network' ); |
| 183 | $this->assertTrue( get_current_screen()->in_admin() ); |
| 184 | $this->assertFalse( get_current_screen()->in_admin( 'blog' ) ); |
| 185 | $this->assertTrue( get_current_screen()->in_admin( 'network' ) ); |
| 186 | $this->assertFalse( get_current_screen()->in_admin( 'user' ) ); |
| 187 | |
| 188 | set_current_screen( 'dashboard-user' ); |
| 189 | $this->assertTrue( get_current_screen()->in_admin() ); |
| 190 | $this->assertFalse( get_current_screen()->in_admin( 'blog' ) ); |
| 191 | $this->assertFalse( get_current_screen()->in_admin( 'network' ) ); |
| 192 | $this->assertTrue( get_current_screen()->in_admin( 'user' ) ); |
| 193 | |
| 194 | set_current_screen( 'front' ); |
| 195 | $this->assertFalse( get_current_screen()->in_admin() ); |
| 196 | $this->assertFalse( get_current_screen()->in_admin( 'blog' ) ); |
| 197 | $this->assertFalse( get_current_screen()->in_admin( 'network' ) ); |
| 198 | $this->assertFalse( get_current_screen()->in_admin( 'user' ) ); |
| 199 | } |