Skip to content

Commit a8e7029

Browse files
committed
Move list of config options to constant
1 parent 0d580b8 commit a8e7029

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

tests/phpunit/tests/template.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
7878
*/
7979
protected $original_theme_features;
8080

81+
/**
82+
* @var array
83+
*/
84+
const RESTORED_CONFIG_OPTIONS = array(
85+
'display_errors',
86+
'error_reporting',
87+
'log_errors',
88+
'error_log',
89+
'default_mimetype',
90+
'html_errors',
91+
'error_prepend_string',
92+
'error_append_string',
93+
);
94+
8195
/**
8296
* @var array
8397
*/
@@ -117,8 +131,8 @@ public function set_up() {
117131
wp_styles();
118132

119133
$this->original_theme_features = $GLOBALS['_wp_theme_features'];
120-
foreach ( array( 'display_errors', 'error_reporting', 'log_errors', 'error_log', 'default_mimetype', 'html_errors', 'error_prepend_string', 'error_append_string' ) as $config ) {
121-
$this->original_ini_config[ $config ] = ini_get( $config );
134+
foreach ( self::RESTORED_CONFIG_OPTIONS as $option ) {
135+
$this->original_ini_config[ $option ] = ini_get( $option );
122136
}
123137
}
124138

@@ -128,8 +142,8 @@ public function tear_down() {
128142
$wp_styles = $this->original_wp_styles;
129143

130144
$GLOBALS['_wp_theme_features'] = $this->original_theme_features;
131-
foreach ( $this->original_ini_config as $config => $value ) {
132-
ini_set( $config, $value );
145+
foreach ( $this->original_ini_config as $option => $value ) {
146+
ini_set( $option, $value );
133147
}
134148

135149
unregister_post_type( 'cpt' );

0 commit comments

Comments
 (0)