diff --git a/composer.json b/composer.json index 6b2877c..22862b6 100644 --- a/composer.json +++ b/composer.json @@ -14,12 +14,12 @@ ], "autoload": { "psr-4": { - "": "src/" + "Phrity\\Util\\": "src/" } }, "autoload-dev": { "psr-4": { - "": "tests/" + "Phrity\\Util\\Tests\\": "tests/" } }, "require": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7a77f4f..eebfbe3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,13 @@ - - - - ./src/ - - + ./tests/ + + + ./src/ + + diff --git a/src/Phrity/Util/ErrorHandler.php b/src/ErrorHandler.php similarity index 100% rename from src/Phrity/Util/ErrorHandler.php rename to src/ErrorHandler.php index ba38462..4cfbacf 100644 --- a/src/Phrity/Util/ErrorHandler.php +++ b/src/ErrorHandler.php @@ -83,8 +83,8 @@ public function withAll(callable $callback, $handling = null, int $levels = E_AL $errors[] = $e; }, $levels); $result = $callback(); - $error = empty($errors) ? null : $this->handle($handling, $errors, $result); $this->restore(); + $error = empty($errors) ? null : $this->handle($handling, $errors, $result); return $error ?: $result; } diff --git a/tests/ErrorHandlerTest.php b/tests/ErrorHandlerTest.php index 66e2515..31e0f49 100644 --- a/tests/ErrorHandlerTest.php +++ b/tests/ErrorHandlerTest.php @@ -42,10 +42,6 @@ public function testSetNull(): void $this->assertNull($e->getPrevious()); } - // Verify that exception is thrown - $this->expectException('ErrorException'); - trigger_error('Another error'); - // Restore handler $this->assertTrue($handler->restore()); } @@ -69,10 +65,6 @@ public function testSetThrowable(): void $this->assertNull($prev->getPrevious()); } - // Verify that exception is thrown - $this->expectException('RuntimeException'); - trigger_error('Another error'); - // Restore handler $this->assertTrue($handler->restore()); }