|
|
@@ -176,6 +176,38 @@ class TestCaseTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * test withErrorReporting
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testWithErrorReporting()
|
|
|
+ {
|
|
|
+ $errorLevel = error_reporting();
|
|
|
+ $this->withErrorReporting(E_USER_WARNING, function () {
|
|
|
+ $this->assertSame(E_USER_WARNING, error_reporting());
|
|
|
+ });
|
|
|
+ $this->assertSame($errorLevel, error_reporting());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * test withErrorReporting with exceptions
|
|
|
+ *
|
|
|
+ * @expectedException \PHPUnit\Framework\AssertionFailedError
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testWithErrorReportingWithException()
|
|
|
+ {
|
|
|
+ $errorLevel = error_reporting();
|
|
|
+ try {
|
|
|
+ $this->withErrorReporting(E_USER_WARNING, function () {
|
|
|
+ $this->assertSame(1, 2);
|
|
|
+ });
|
|
|
+ } finally {
|
|
|
+ $this->assertSame($errorLevel, error_reporting());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* testDeprecated
|
|
|
*
|
|
|
* @return void
|