Skip to content

Commit 2524a9b

Browse files
committed
Tests: Remove redundant template-global restoration.
Remove the backup properties and setup and teardown overrides from the `locate_template()` and `_wp_is_template_path_allowed()` test classes. The inherited teardown already resets `$wp_stylesheet_path` and `$wp_template_path` to `null`, superseding the custom restoration. Follow-up to [64361]. Developed in: #14316 Props huzaifaalmesbah. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64399 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8c8d15d commit 2524a9b

2 files changed

Lines changed: 0 additions & 64 deletions

File tree

‎tests/phpunit/tests/theme/locateTemplate.php‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,6 @@
99
*/
1010
class Tests_Theme_LocateTemplate extends WP_UnitTestCase {
1111

12-
/**
13-
* Original path to the stylesheet directory.
14-
*
15-
* @var string|null
16-
*/
17-
private $original_stylesheet_path;
18-
19-
/**
20-
* Original path to the template directory.
21-
*
22-
* @var string|null
23-
*/
24-
private $original_template_path;
25-
26-
public function set_up() {
27-
parent::set_up();
28-
29-
global $wp_stylesheet_path, $wp_template_path;
30-
31-
$this->original_stylesheet_path = $wp_stylesheet_path;
32-
$this->original_template_path = $wp_template_path;
33-
}
34-
35-
public function tear_down() {
36-
global $wp_stylesheet_path, $wp_template_path;
37-
38-
$wp_stylesheet_path = $this->original_stylesheet_path;
39-
$wp_template_path = $this->original_template_path;
40-
41-
parent::tear_down();
42-
}
43-
4412
/**
4513
* Tests that a template name containing a parent directory segment
4614
* is only located when it resolves inside an allowed directory.

‎tests/phpunit/tests/theme/wpIsTemplatePathAllowed.php‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,6 @@
99
*/
1010
class Tests_Theme_wpIsTemplatePathAllowed extends WP_UnitTestCase {
1111

12-
/**
13-
* Original path to the stylesheet directory.
14-
*
15-
* @var string|null
16-
*/
17-
private $original_stylesheet_path;
18-
19-
/**
20-
* Original path to the template directory.
21-
*
22-
* @var string|null
23-
*/
24-
private $original_template_path;
25-
26-
public function set_up() {
27-
parent::set_up();
28-
29-
global $wp_stylesheet_path, $wp_template_path;
30-
31-
$this->original_stylesheet_path = $wp_stylesheet_path;
32-
$this->original_template_path = $wp_template_path;
33-
}
34-
35-
public function tear_down() {
36-
global $wp_stylesheet_path, $wp_template_path;
37-
38-
$wp_stylesheet_path = $this->original_stylesheet_path;
39-
$wp_template_path = $this->original_template_path;
40-
41-
parent::tear_down();
42-
}
43-
4412
/**
4513
* Tests that a path without a parent directory segment is allowed without further checks.
4614
*

0 commit comments

Comments
 (0)