Changeset 48463
- Timestamp:
- 07/14/2020 12:32:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/themeFile.php
r46586 r48463 6 6 7 7 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 8 if ( ! function_exists( 'symlink' ) ) { 9 self::markTestSkipped( 'symlink() is not available.' ); 10 } 11 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 12 if ( ! @symlink( DIR_TESTDATA . '/theme-file-parent', WP_CONTENT_DIR . '/themes/theme-file-parent' ) ) { 13 self::markTestSkipped( 'Could not create parent symlink.' ); 14 } 15 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 16 if ( ! @symlink( DIR_TESTDATA . '/theme-file-child', WP_CONTENT_DIR . '/themes/theme-file-child' ) ) { 17 self::markTestSkipped( 'Could not create child symlink.' ); 8 $themes = array( 9 'theme-file-parent', 10 'theme-file-child', 11 ); 12 13 // Copy themes from tests/phpunit/data to wp-content/themes. 14 foreach ( $themes as $theme ) { 15 $source_dir = DIR_TESTDATA . '/' . $theme; 16 $dest_dir = WP_CONTENT_DIR . '/themes/' . $theme; 17 18 mkdir( $dest_dir ); 19 20 foreach ( glob( $source_dir . '/*.*' ) as $theme_file ) { 21 copy( $theme_file, $dest_dir . '/' . basename( $theme_file ) ); 22 } 18 23 } 19 24 } 20 25 21 26 public static function wpTearDownAfterClass() { 22 unlink( WP_CONTENT_DIR . '/themes/theme-file-parent' ); 23 unlink( WP_CONTENT_DIR . '/themes/theme-file-child' ); 27 $themes = array( 28 'theme-file-parent', 29 'theme-file-child', 30 ); 31 32 // Remove previously copied themes from wp-content/themes. 33 foreach ( $themes as $theme ) { 34 $dest_dir = WP_CONTENT_DIR . '/themes/' . $theme; 35 36 foreach ( glob( $dest_dir . '/*.*' ) as $theme_file ) { 37 unlink( $theme_file ); 38 } 39 40 rmdir( $dest_dir ); 41 } 24 42 } 25 43
Note: See TracChangeset
for help on using the changeset viewer.