Changeset 48937 for trunk/tests/phpunit/tests/theme/WPTheme.php
- Timestamp:
- 09/02/2020 12:35:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/WPTheme.php
r47122 r48937 37 37 38 38 // Meta. 39 $this->assert Equals( 'My Theme', $theme->get( 'Name' ) );40 $this->assert Equals( 'http://example.org/', $theme->get( 'ThemeURI' ) );41 $this->assert Equals( 'An example theme', $theme->get( 'Description' ) );42 $this->assert Equals( 'Minnie Bannister', $theme->get( 'Author' ) );43 $this->assert Equals( 'http://example.com/', $theme->get( 'AuthorURI' ) );44 $this->assert Equals( '1.3', $theme->get( 'Version' ) );45 $this->assert Equals( '', $theme->get( 'Template' ) );46 $this->assert Equals( 'publish', $theme->get( 'Status' ) );47 $this->assert Equals( array(), $theme->get( 'Tags' ) );39 $this->assertSame( 'My Theme', $theme->get( 'Name' ) ); 40 $this->assertSame( 'http://example.org/', $theme->get( 'ThemeURI' ) ); 41 $this->assertSame( 'An example theme', $theme->get( 'Description' ) ); 42 $this->assertSame( 'Minnie Bannister', $theme->get( 'Author' ) ); 43 $this->assertSame( 'http://example.com/', $theme->get( 'AuthorURI' ) ); 44 $this->assertSame( '1.3', $theme->get( 'Version' ) ); 45 $this->assertSame( '', $theme->get( 'Template' ) ); 46 $this->assertSame( 'publish', $theme->get( 'Status' ) ); 47 $this->assertSame( array(), $theme->get( 'Tags' ) ); 48 48 49 49 // Important. 50 $this->assert Equals( 'theme1', $theme->get_stylesheet() );51 $this->assert Equals( 'theme1', $theme->get_template() );50 $this->assertSame( 'theme1', $theme->get_stylesheet() ); 51 $this->assertSame( 'theme1', $theme->get_template() ); 52 52 } 53 53 … … 56 56 57 57 // Meta. 58 $this->assert Equals( 'My Subdir Theme', $theme->get( 'Name' ) );59 $this->assert Equals( 'http://example.org/', $theme->get( 'ThemeURI' ) );60 $this->assert Equals( 'An example theme in a sub directory', $theme->get( 'Description' ) );61 $this->assert Equals( 'Mr. WordPress', $theme->get( 'Author' ) );62 $this->assert Equals( 'http://wordpress.org/', $theme->get( 'AuthorURI' ) );63 $this->assert Equals( '0.1', $theme->get( 'Version' ) );64 $this->assert Equals( '', $theme->get( 'Template' ) );65 $this->assert Equals( 'publish', $theme->get( 'Status' ) );66 $this->assert Equals( array(), $theme->get( 'Tags' ) );58 $this->assertSame( 'My Subdir Theme', $theme->get( 'Name' ) ); 59 $this->assertSame( 'http://example.org/', $theme->get( 'ThemeURI' ) ); 60 $this->assertSame( 'An example theme in a sub directory', $theme->get( 'Description' ) ); 61 $this->assertSame( 'Mr. WordPress', $theme->get( 'Author' ) ); 62 $this->assertSame( 'http://wordpress.org/', $theme->get( 'AuthorURI' ) ); 63 $this->assertSame( '0.1', $theme->get( 'Version' ) ); 64 $this->assertSame( '', $theme->get( 'Template' ) ); 65 $this->assertSame( 'publish', $theme->get( 'Status' ) ); 66 $this->assertSame( array(), $theme->get( 'Tags' ) ); 67 67 68 68 // Important. 69 $this->assert Equals( 'subdir/theme2', $theme->get_stylesheet() );70 $this->assert Equals( 'subdir/theme2', $theme->get_template() );69 $this->assertSame( 'subdir/theme2', $theme->get_stylesheet() ); 70 $this->assertSame( 'subdir/theme2', $theme->get_template() ); 71 71 } 72 72 … … 79 79 80 80 // Meta. 81 $this->assert Equals( 'My Subdir Theme', $theme->get( 'Name' ) );82 $this->assert Equals( 'http://example.org/', $theme->get( 'ThemeURI' ) );83 $this->assert Equals( 'An example theme in a sub directory', $theme->get( 'Description' ) );84 $this->assert Equals( 'Mr. WordPress', $theme->get( 'Author' ) );85 $this->assert Equals( 'http://wordpress.org/', $theme->get( 'AuthorURI' ) );86 $this->assert Equals( '0.1', $theme->get( 'Version' ) );87 $this->assert Equals( '', $theme->get( 'Template' ) );88 $this->assert Equals( 'publish', $theme->get( 'Status' ) );89 $this->assert Equals( array(), $theme->get( 'Tags' ) );81 $this->assertSame( 'My Subdir Theme', $theme->get( 'Name' ) ); 82 $this->assertSame( 'http://example.org/', $theme->get( 'ThemeURI' ) ); 83 $this->assertSame( 'An example theme in a sub directory', $theme->get( 'Description' ) ); 84 $this->assertSame( 'Mr. WordPress', $theme->get( 'Author' ) ); 85 $this->assertSame( 'http://wordpress.org/', $theme->get( 'AuthorURI' ) ); 86 $this->assertSame( '0.1', $theme->get( 'Version' ) ); 87 $this->assertSame( '', $theme->get( 'Template' ) ); 88 $this->assertSame( 'publish', $theme->get( 'Status' ) ); 89 $this->assertSame( array(), $theme->get( 'Tags' ) ); 90 90 91 91 // Important. 92 $this->assert Equals( 'subdir/theme2', $theme->get_stylesheet() );93 $this->assert Equals( 'subdir/theme2', $theme->get_template() );92 $this->assertSame( 'subdir/theme2', $theme->get_stylesheet() ); 93 $this->assertSame( 'subdir/theme2', $theme->get_template() ); 94 94 } 95 95 … … 100 100 $theme = new WP_Theme( 'theme with spaces', $this->theme_root . '/subdir' ); 101 101 // Make sure subdir/ is considered part of the stylesheet, as we must avoid encoding /'s. 102 $this->assert Equals( 'subdir/theme with spaces', $theme->get_stylesheet() );102 $this->assertSame( 'subdir/theme with spaces', $theme->get_stylesheet() ); 103 103 104 104 // Check that in a URI path, we have raw URL encoding (spaces become %20). 105 105 // Don't try to verify the complete URI path. get_theme_root_uri() breaks down quickly. 106 $this->assert Equals( 'theme%20with%20spaces', basename( $theme->get_stylesheet_directory_uri() ) );107 $this->assert Equals( 'theme%20with%20spaces', basename( $theme->get_template_directory_uri() ) );106 $this->assertSame( 'theme%20with%20spaces', basename( $theme->get_stylesheet_directory_uri() ) ); 107 $this->assertSame( 'theme%20with%20spaces', basename( $theme->get_template_directory_uri() ) ); 108 108 109 109 // Check that wp_customize_url() uses URL encoding, as it is a query arg (spaces become +). 110 $this->assert Equals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) );110 $this->assertSame( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) ); 111 111 } 112 112 … … 119 119 add_filter( 'template', $callback ); 120 120 121 $this->assert Equals( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_stylesheet_directory_uri() );122 $this->assert Equals( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_template_directory_uri() );121 $this->assertSame( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_stylesheet_directory_uri() ); 122 $this->assertSame( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_template_directory_uri() ); 123 123 124 124 remove_filter( 'stylesheet', $callback ); … … 135 135 function test_display_method_on_get_method_failure() { 136 136 $theme = new WP_Theme( 'nonexistent', $this->theme_root ); 137 $this->assert Equals( 'nonexistent', $theme->get( 'Name' ) );137 $this->assertSame( 'nonexistent', $theme->get( 'Name' ) ); 138 138 $this->assertFalse( $theme->get( 'AuthorURI' ) ); 139 139 $this->assertFalse( $theme->get( 'Tags' ) ); … … 148 148 $errors = $theme->errors(); 149 149 $this->assertWPError( $errors ); 150 $this->assert Equals( 'theme_child_invalid', $errors->get_error_code() );150 $this->assertSame( 'theme_child_invalid', $errors->get_error_code() ); 151 151 } 152 152
Note: See TracChangeset
for help on using the changeset viewer.