Changeset 9831 for trunk/tests/phpunit
- Timestamp:
- 05/02/2015 08:55:07 PM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r9819 r9831 424 424 $wpdb->query( 'COMMIT;' ); 425 425 } 426 427 /** 428 * Clean up created directories/files 429 */ 430 public function rrmdir( $dir ) { 431 // Make sure we are only removing files/dir from uploads 432 if ( 0 !== strpos( $dir, bp_core_avatar_upload_path() ) ) { 433 return; 434 } 435 436 $d = glob( $dir . '/*' ); 437 438 if ( ! empty( $d ) ) { 439 foreach ( $d as $file ) { 440 if ( is_dir( $file ) ) { 441 $this->rrmdir( $file ); 442 } else { 443 @unlink( $file ); 444 } 445 } 446 } 447 448 @rmdir( $dir ); 449 } 426 450 } -
trunk/tests/phpunit/testcases/core/avatars.php
r9819 r9831 15 15 16 16 $this->rrmdir( bp_core_avatar_upload_path() . '/' . $avatar_dir ); 17 }18 19 private function rrmdir( $dir ) {20 $d = glob( $dir . '/*' );21 22 if ( empty( $d ) ) {23 return;24 }25 26 foreach ( $d as $file ) {27 if ( is_dir( $file ) ) {28 $this->rrmdir( $file );29 } else {30 @unlink( $file );31 }32 }33 34 @rmdir( $dir );35 17 } 36 18 -
trunk/tests/phpunit/testcases/core/functions.php
r9819 r9831 599 599 } 600 600 } 601 602 /** 603 * @group bp_attachments 604 * @group bp_upload_dir 605 */ 606 public function test_bp_upload_dir_ms() { 607 if ( ! is_multisite() ) { 608 $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' ); 609 } 610 611 $expected_upload_dir = wp_upload_dir(); 612 613 $b = $this->factory->blog->create(); 614 615 switch_to_blog( $b ); 616 617 $tested_upload_dir = bp_upload_dir(); 618 619 restore_current_blog(); 620 621 $this->assertSame( $expected_upload_dir, $tested_upload_dir ); 622 } 601 623 }
Note: See TracChangeset
for help on using the changeset viewer.