Changeset 30658
- Timestamp:
- 11/30/2014 07:05:52 PM (10 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r30526 r30658 484 484 } 485 485 486 function delete_folders( $path ) { 487 $this->matched_dirs = array(); 488 if ( ! is_dir( $path ) ) { 489 return; 490 } 491 492 $this->scandir( $path ); 493 foreach ( array_reverse( $this->matched_dirs ) as $dir ) { 494 rmdir( $dir ); 495 } 496 rmdir( $path ); 497 } 498 499 function scandir( $dir ) { 500 foreach ( scandir( $dir ) as $path ) { 501 if ( 0 !== strpos( $path, '.' ) && is_dir( $dir . '/' . $path ) ) { 502 $this->matched_dirs[] = $dir . '/' . $path; 503 $this->scandir( $dir . '/' . $path ); 504 } 505 } 506 } 507 486 508 /** 487 509 * Helper to Convert a microtime string into a float -
trunk/tests/phpunit/tests/upload.php
r29120 r30658 1 1 <?php 2 3 4 2 /** 5 3 * @group upload … … 11 9 12 10 function setUp() { 13 if ( is_multisite() ) 11 if ( is_multisite() ) { 14 12 $this->knownUTBug( 35 ); 13 } 15 14 15 $this->_reset_options(); 16 16 parent::setUp(); 17 return; 17 } 18 19 function _reset_options() { 18 20 // system defaults 19 21 update_option( 'upload_path', 'wp-content/uploads' ); 20 22 update_option( 'upload_url_path', '' ); 21 23 update_option( 'uploads_use_yearmonth_folders', 1 ); 22 }23 24 function tearDown() {25 $this->remove_added_uploads();26 27 parent::tearDown();28 24 } 29 25 … … 41 37 update_option( 'upload_path', 'foo/bar' ); 42 38 $info = wp_upload_dir(); 39 $this->delete_folders( ABSPATH . 'foo' ); 40 43 41 $this->assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] ); 44 42 $this->assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] ); … … 57 55 update_option( 'upload_url_path', '/baz' ); 58 56 $info = wp_upload_dir(); 57 $this->delete_folders( $path ); 58 59 59 $this->assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] ); 60 60 $this->assertEquals( "$path/" . gmstrftime('%Y/%m'), $info['path'] );
Note: See TracChangeset
for help on using the changeset viewer.