File tree Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,10 @@ protected function printFooter()
73
73
{
74
74
// Turn off errors so we don't get timezone warnings if people
75
75
// don't have their timezone set.
76
- error_reporting (0 );
76
+ $ errorLevel = error_reporting (0 );
77
77
echo 'Documentation generated on ' .date ('r ' );
78
78
echo ' by [PHP_CodeSniffer ' .Config::VERSION .'](https://github.com/PHPCSStandards/PHP_CodeSniffer) ' .PHP_EOL ;
79
+ error_reporting ($ errorLevel );
79
80
80
81
}//end printFooter()
81
82
Original file line number Diff line number Diff line change @@ -101,4 +101,32 @@ public function testFooter()
101
101
}//end testFooter()
102
102
103
103
104
+ /**
105
+ * Safeguard that the footer logic doesn't permanently change the error level.
106
+ *
107
+ * @runInSeparateProcess
108
+ * @preserveGlobalState disabled
109
+ *
110
+ * @return void
111
+ */
112
+ public function testFooterResetsErrorReportingToOriginalSetting ()
113
+ {
114
+ $ expected = error_reporting ();
115
+
116
+ // Set up the ruleset.
117
+ $ standard = __DIR__ .'/OneDocTest.xml ' ;
118
+ $ config = new ConfigDouble (["--standard= $ standard " ]);
119
+ $ ruleset = new Ruleset ($ config );
120
+
121
+ // We know there will be output, but we're not interested in the output for this test.
122
+ ob_start ();
123
+ $ generator = new HTMLDouble ($ ruleset );
124
+ $ generator ->printRealFooter ();
125
+ ob_end_clean ();
126
+
127
+ $ this ->assertSame ($ expected , error_reporting ());
128
+
129
+ }//end testFooterResetsErrorReportingToOriginalSetting()
130
+
131
+
104
132
}//end class
Original file line number Diff line number Diff line change @@ -99,4 +99,32 @@ public function testFooter()
99
99
}//end testFooter()
100
100
101
101
102
+ /**
103
+ * Safeguard that the footer logic doesn't permanently change the error level.
104
+ *
105
+ * @runInSeparateProcess
106
+ * @preserveGlobalState disabled
107
+ *
108
+ * @return void
109
+ */
110
+ public function testFooterResetsErrorReportingToOriginalSetting ()
111
+ {
112
+ $ expected = error_reporting ();
113
+
114
+ // Set up the ruleset.
115
+ $ standard = __DIR__ .'/OneDocTest.xml ' ;
116
+ $ config = new ConfigDouble (["--standard= $ standard " ]);
117
+ $ ruleset = new Ruleset ($ config );
118
+
119
+ // We know there will be output, but we're not interested in the output for this test.
120
+ ob_start ();
121
+ $ generator = new MarkdownDouble ($ ruleset );
122
+ $ generator ->printRealFooter ();
123
+ ob_end_clean ();
124
+
125
+ $ this ->assertSame ($ expected , error_reporting ());
126
+
127
+ }//end testFooterResetsErrorReportingToOriginalSetting()
128
+
129
+
102
130
}//end class
You can’t perform that action at this time.
0 commit comments