diff --git tests/phpunit/tests/theme.php tests/phpunit/tests/theme.php
index 3238f6e..895ecf8 100644
|
|
class Tests_Theme extends WP_UnitTestCase { |
48 | 48 | $this->assertEquals( $themes[ $this->theme_slug ], $single_theme ); |
49 | 49 | } |
50 | 50 | |
51 | | /** |
52 | | * @expectedDeprecated get_theme |
53 | | * @expectedDeprecated get_themes |
54 | | */ |
55 | 51 | function test_get_themes_default() { |
56 | | $themes = get_themes(); |
57 | | $this->assertInstanceOf( 'WP_Theme', $themes[ $this->theme_name ] ); |
58 | | $this->assertEquals( $themes[ $this->theme_name ], get_theme( $this->theme_name ) ); |
| 52 | $themes = wp_get_themes(); |
| 53 | $this->assertInstanceOf( 'WP_Theme', $themes[ $this->theme_slug ] ); |
| 54 | $this->assertEquals( $themes[ $this->theme_slug ], wp_get_theme( $this->theme_slug )->get( 'Name' ) ); |
| 55 | |
| 56 | $this->assertEquals( $this->theme_name, $themes[ $this->theme_slug ]['Name'] ); |
| 57 | $this->assertEquals( $this->theme_name, $themes[ $this->theme_slug ]->Name ); |
| 58 | $this->assertEquals( $this->theme_name, $themes[ $this->theme_slug ]->name ); |
59 | 59 | |
60 | | $this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]['Name'] ); |
61 | | $this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]->Name ); |
62 | | $this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]->name ); |
63 | 60 | } |
64 | 61 | |
65 | | /** |
66 | | * @expectedDeprecated get_theme |
67 | | * @expectedDeprecated get_themes |
68 | | */ |
69 | 62 | function test_get_theme() { |
70 | | $themes = get_themes(); |
| 63 | $themes = wp_get_themes(); |
71 | 64 | foreach (array_keys($themes) as $name) { |
72 | | $theme = get_theme($name); |
| 65 | $theme = wp_get_theme($name); |
73 | 66 | // WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array(). |
74 | 67 | $this->assertFalse( is_array( $theme ) ); |
75 | 68 | $this->assertInstanceOf( 'WP_Theme', $theme ); |
… |
… |
class Tests_Theme extends WP_UnitTestCase { |
89 | 82 | } |
90 | 83 | } |
91 | 84 | |
92 | | /** |
93 | | * @expectedDeprecated get_themes |
94 | | */ |
95 | 85 | function test_get_themes_contents() { |
96 | | $themes = get_themes(); |
| 86 | $themes = wp_get_themes(); |
97 | 87 | // Generic tests that should hold true for any theme |
98 | 88 | foreach ( $themes as $k => $theme ) { |
99 | 89 | // Don't run these checks for custom themes. |
100 | 90 | if ( empty( $theme['Author'] ) || false === strpos( $theme['Author'], 'WordPress' ) ) { |
101 | 91 | continue; |
102 | 92 | } |
103 | | |
104 | | $this->assertEquals( $theme['Name'], $k ); |
| 93 | $this->assertEquals( $theme->get_template(), $k ); |
105 | 94 | $this->assertNotEmpty( $theme['Title'] ); |
106 | 95 | |
107 | 96 | // important attributes should all be set |
… |
… |
class Tests_Theme extends WP_UnitTestCase { |
222 | 211 | return array( 'License' ); |
223 | 212 | } |
224 | 213 | |
225 | | /** |
226 | | * @expectedDeprecated get_themes |
227 | | * @expectedDeprecated get_current_theme |
228 | | */ |
229 | 214 | function test_switch_theme() { |
230 | | $themes = get_themes(); |
| 215 | $themes = wp_get_themes(); |
231 | 216 | |
232 | 217 | // Switch to each theme in sequence. |
233 | 218 | // Do it twice to make sure we switch to the first theme, even if it's our starting theme. |
… |
… |
class Tests_Theme extends WP_UnitTestCase { |
241 | 226 | else |
242 | 227 | switch_theme( $theme['Stylesheet'] ); |
243 | 228 | |
244 | | $this->assertEquals($name, get_current_theme()); |
| 229 | $this->assertEquals($name, wp_get_theme()->get_template() ); |
245 | 230 | |
246 | 231 | // make sure the various get_* functions return the correct values |
247 | 232 | $this->assertEquals($theme['Template'], get_template()); |