Skip to content

Commit

Permalink
Tidy up the phpunit config and ensure all errors cause test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Oct 30, 2024
1 parent f1fb14c commit b5b54bc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/tests export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/phpunit.xml export-ignore
/phpunit.xml.dist export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/composer.lock
/phpunit.xml
/vendor
17 changes: 0 additions & 17 deletions phpunit.xml

This file was deleted.

10 changes: 10 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<phpunit bootstrap="tests/bootstrap.php">
<testsuite name="CLImate">
<directory suffix="Test.php">tests</directory>
</testsuite>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
10 changes: 10 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

require __DIR__ . "/../vendor/autoload.php";

set_error_handler(static function ($errno, $errstr, $errfile, $errline): bool {
if (!(error_reporting() & $errno)) {
return false;
}
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
}, \E_ALL);

0 comments on commit b5b54bc

Please sign in to comment.