| | 284 | * @group bp_core_get_directory_page_ids |
| | 285 | */ |
| | 286 | public function test_bp_core_get_directory_page_ids_on_directory_page_to_trash() { |
| | 287 | $old_page_ids = bp_core_get_directory_page_ids(); |
| | 288 | |
| | 289 | // grab the and remove the first page |
| | 290 | foreach ( $old_page_ids as $component => $page_id ) { |
| | 291 | $p = $page_id; |
| | 292 | unset( $old_page_ids[ $component ] ); |
| | 293 | break; |
| | 294 | } |
| | 295 | |
| | 296 | // move page to trash |
| | 297 | wp_delete_post( $p, false ); |
| | 298 | |
| | 299 | $new_page_ids = bp_core_get_directory_page_ids(); |
| | 300 | |
| | 301 | $this->assertEquals( $old_page_ids, $new_page_ids ); |
| | 302 | } |
| | 303 | |
| | 304 | /** |
| | 305 | * @group bp_core_get_directory_page_ids |
| | 306 | */ |
| | 307 | public function test_bp_core_get_directory_page_ids_on_directory_page_delete() { |
| | 308 | $old_page_ids = bp_core_get_directory_page_ids(); |
| | 309 | |
| | 310 | // grab the and remove the first page |
| | 311 | foreach ( $old_page_ids as $component => $page_id ) { |
| | 312 | $p = $page_id; |
| | 313 | unset( $old_page_ids[ $component ] ); |
| | 314 | break; |
| | 315 | } |
| | 316 | |
| | 317 | // force delete page |
| | 318 | wp_delete_post( $p, true ); |
| | 319 | |
| | 320 | $new_page_ids = bp_core_get_directory_page_ids(); |
| | 321 | |
| | 322 | $this->assertEquals( $old_page_ids, $new_page_ids ); |
| | 323 | } |
| | 324 | |
| | 325 | /** |
| | 326 | * @group bp_core_get_directory_page_ids |
| | 327 | */ |
| | 328 | public function test_bp_core_get_directory_page_ids_on_non_directory_page_delete() { |
| | 329 | $old_page_ids = bp_core_get_directory_page_ids(); |
| | 330 | |
| | 331 | $p = $this->factory->post->create( array( |
| | 332 | 'post_status' => 'publish', |
| | 333 | 'post_type' => 'page', |
| | 334 | ) ); |
| | 335 | |
| | 336 | // force delete page |
| | 337 | wp_delete_post( $p, true ); |
| | 338 | |
| | 339 | $new_page_ids = bp_core_get_directory_page_ids(); |
| | 340 | |
| | 341 | $this->assertEquals( $old_page_ids, $new_page_ids ); |
| | 342 | } |
| | 343 | |
| | 344 | /** |
| | 345 | * @group bp_core_get_directory_page_ids |
| | 346 | */ |
| | 347 | public function test_bp_core_get_directory_page_ids_non_active_component() { |
| | 348 | $old_page_ids = bp_core_get_directory_page_ids(); |
| | 349 | $bp = buddypress(); |
| | 350 | |
| | 351 | // grab the and remove the first page |
| | 352 | foreach ( $old_page_ids as $component => $page_id ) { |
| | 353 | $p = $page_id; |
| | 354 | $c = $component; |
| | 355 | unset( $old_page_ids[ $component ] ); |
| | 356 | break; |
| | 357 | } |
| | 358 | |
| | 359 | // deactivate component |
| | 360 | unset( $bp->active_components[ $c ] ); |
| | 361 | |
| | 362 | $new_page_ids = bp_core_get_directory_page_ids(); |
| | 363 | |
| | 364 | // restore components |
| | 365 | $bp->active_components[ $c ] = 1; |
| | 366 | |
| | 367 | $this->assertEquals( $old_page_ids, $new_page_ids ); |
| | 368 | } |
| | 369 | |
| | 370 | /** |