Changeset 38858
- Timestamp:
- 10/21/2016 11:02:37 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/data/themedir1/default/functions.php
r25002 r38858 1 1 <?php 2 2 3 // dummy theme3 // Minimum functions.php to pass unit tests 4 4 5 echo dirname(__FILE__).'/'.basename(__FILE__); 5 function default_widgets_init() { 6 register_sidebar( array( 'id' => 'sidebar-1' ) ); 7 } 8 add_action( 'widgets_init', 'default_widgets_init' ); 6 9 7 ?> 10 function default_after_setup_theme() { 11 add_theme_support( 'post-thumbnails' ); 12 13 // Don't call it after wp_loaded has happened, for tests that manually re-run load actions. 14 if( ! did_action( 'wp_loaded' ) ) { 15 add_theme_support( 'title-tag' ); 16 } 17 } 18 add_action( 'after_setup_theme', 'default_after_setup_theme' ); -
trunk/tests/phpunit/data/themedir1/default/index.php
r25002 r38858 1 1 <?php 2 2 3 // dummy theme 4 5 echo dirname(__FILE__).'/'.basename(__FILE__); 6 7 ?> 3 // Empty theme -
trunk/tests/phpunit/includes/bootstrap.php
r38840 r38858 53 53 require_once( dirname( __FILE__ ) . '/mock-mailer.php' ); 54 54 $phpmailer = new MockPHPMailer(); 55 56 // Add a symlink to the empty default theme to the themes directory, so it can be used for the tests. 57 _symlink_default_theme(); 55 58 56 59 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite ); -
trunk/tests/phpunit/includes/functions.php
r38582 r38858 162 162 return $uploads; 163 163 } 164 165 /** 166 * Helper functions to link and unlink the empty default theme into the WordPress install 167 */ 168 function _symlink_default_theme() { 169 _unlink_default_theme(); 170 symlink( DIR_TESTDATA . '/themedir1/default', ABSPATH . '/wp-content/themes/default' ); 171 } 172 173 function _unlink_default_theme() { 174 if ( file_exists( ABSPATH . '/wp-content/themes/default' ) ) { 175 unlink( ABSPATH . '/wp-content/themes/default' ); 176 } 177 } 178 // Only unlink when we're in the main process. 179 if ( 'phpunit' === substr( $GLOBALS['argv'][0], -7 ) ) { 180 register_shutdown_function( '_unlink_default_theme' ); 181 } -
trunk/tests/phpunit/tests/customize/control.php
r38850 r38858 32 32 // @codingStandardsIgnoreEnd 33 33 $this->wp_customize = $GLOBALS['wp_customize']; 34 35 // Remove default theme actions that interfere with tests36 remove_action( 'customize_register', 'twentyseventeen_customize_register' );37 34 } 38 35 -
trunk/tests/phpunit/tests/customize/custom-css-setting.php
r38850 r38858 37 37 $wp_customize = $this->wp_customize; 38 38 39 // Remove default theme actions that interfere with tests40 remove_action( 'customize_register', 'twentyseventeen_customize_register' );41 42 39 do_action( 'customize_register', $this->wp_customize ); 43 40 $this->setting = new WP_Customize_Custom_CSS_Setting( $this->wp_customize, 'custom_css[twentysixteen]' ); -
trunk/tests/phpunit/tests/customize/manager.php
r38850 r38858 59 59 $this->manager = $this->instantiate(); 60 60 $this->undefined = new stdClass(); 61 62 // Remove default theme actions that interfere with tests63 remove_action( 'customize_register', 'twentyseventeen_customize_register' );64 61 } 65 62 -
trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php
r38850 r38858 27 27 $this->wp_customize = new WP_Customize_Manager(); 28 28 $wp_customize = $this->wp_customize; 29 30 // Remove default theme actions that interfere with tests31 remove_action( 'customize_register', 'twentyseventeen_customize_register' );32 29 } 33 30 -
trunk/tests/phpunit/tests/customize/nav-menu-setting.php
r38850 r38858 28 28 $this->wp_customize = new WP_Customize_Manager(); 29 29 $wp_customize = $this->wp_customize; 30 31 // Remove default theme actions that interfere with tests32 remove_action( 'customize_register', 'twentyseventeen_customize_register' );33 30 } 34 31 -
trunk/tests/phpunit/tests/customize/nav-menus.php
r38850 r38858 27 27 $this->wp_customize = new WP_Customize_Manager(); 28 28 $wp_customize = $this->wp_customize; 29 30 // Remove default theme actions that interfere with tests31 remove_action( 'customize_register', 'twentyseventeen_customize_register' );32 29 } 33 30 -
trunk/tests/phpunit/tests/customize/partial.php
r38850 r38858 40 40 $this->selective_refresh = $this->wp_customize->selective_refresh; 41 41 } 42 43 // Remove default theme actions that interfere with tests44 remove_action( 'customize_register', 'twentyseventeen_customize_register' );45 42 } 46 43 -
trunk/tests/phpunit/tests/customize/selective-refresh-ajax.php
r38851 r38858 52 52 $this->selective_refresh = $this->wp_customize->selective_refresh; 53 53 } 54 55 // Remove default theme actions that interfere with tests56 remove_action( 'customize_register', 'twentyseventeen_customize_register' );57 54 } 58 55 … … 61 58 */ 62 59 function do_customize_boot_actions() { 63 // Remove actions that call add_theme_support( 'title-tag' ).64 remove_action( 'after_setup_theme', 'twentyfifteen_setup' );65 remove_action( 'after_setup_theme', 'twentysixteen_setup' );66 remove_action( 'after_setup_theme', 'twentyseventeen_setup' );67 68 60 $_SERVER['REQUEST_METHOD'] = 'POST'; 69 61 do_action( 'setup_theme' ); -
trunk/tests/phpunit/tests/customize/selective-refresh.php
r38850 r38858 40 40 $this->selective_refresh = $this->wp_customize->selective_refresh; 41 41 } 42 43 // Remove default theme actions that interfere with tests44 remove_action( 'customize_register', 'twentyseventeen_customize_register' );45 42 } 46 43 -
trunk/tests/phpunit/tests/customize/widgets.php
r38850 r38858 40 40 $this->assertArrayHasKey( 2, $widget_categories ); 41 41 $this->assertEquals( '', $widget_categories[2]['title'] ); 42 43 // @todo We should not be including a theme anyway44 remove_action( 'after_setup_theme', 'twentyfifteen_setup' );45 remove_action( 'after_setup_theme', 'twentysixteen_setup' );46 remove_action( 'customize_register', 'twentysixteen_customize_register', 11 );47 remove_action( 'after_setup_theme', 'twentyseventeen_setup' );48 remove_action( 'customize_register', 'twentyseventeen_customize_register' );49 42 50 43 $this->backup_registered_sidebars = $GLOBALS['wp_registered_sidebars']; -
trunk/tests/phpunit/tests/media.php
r38838 r38858 34 34 $this->img_html = '<img src="' . $this->img_url . '"/>'; 35 35 $this->img_meta = array( 'width' => 100, 'height' => 100, 'sizes' => '' ); 36 37 // Disable Twenty Seventeen changes to the image size attribute38 remove_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_attr' );39 remove_filter( 'wp_get_attachment_image_attributes', 'twentyseventeen_post_thumbnail_sizes_attr' );40 }41 42 function tearDown() {43 parent::tearDown();44 45 // Reset Twenty Seventeen behaviour46 add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_attr', 10, 2 );47 add_filter( 'wp_get_attachment_image_attributes', 'twentyseventeen_post_thumbnail_sizes_attr', 10, 3 );48 36 } 49 37 -
trunk/wp-tests-config-sample.php
r36372 r38858 3 3 /* Path to the WordPress codebase you'd like to test. Add a forward slash in the end. */ 4 4 define( 'ABSPATH', dirname( __FILE__ ) . '/src/' ); 5 6 /* 7 * Path to the theme to test with. 8 * 9 * The 'default' theme is symlinked from test/phpunit/data/themedir1/default into 10 * the themes directory of the WordPress install defined above. 11 */ 12 define( 'WP_DEFAULT_THEME', 'default' ); 5 13 6 14 // Test with multisite enabled.
Note: See TracChangeset
for help on using the changeset viewer.