revert and fix phpunit

This commit is contained in:
Jérémy Munsch 2023-06-02 12:38:08 +02:00
parent beb64c6470
commit b671dd3e1c
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
4 changed files with 41 additions and 33 deletions

View file

@ -32,8 +32,6 @@
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>

View file

@ -15,37 +15,9 @@ use Kwaadpepper\Enum\Tests\Enums\NotRoutableEnum;
use Kwaadpepper\Enum\Tests\Models\Alarm;
use Kwaadpepper\Enum\Tests\Models\Journal;
use Kwaadpepper\Enum\Tests\Models\Report;
use Orchestra\Testbench\TestCase;
class BaseEnumRoutableTest extends TestCase
{
/**
* Setup custom phpunit catch for deprecated error cathing.
*
* @return void
*/
public function setUp(): void
{
set_error_handler(
static function ($errno, $errstr) {
throw new \Exception($errstr, $errno);
},
E_ALL
);
parent::setUp();
}
/**
* Restore phpunit handler
*
* @return void
*/
public function tearDown(): void
{
restore_error_handler();
parent::tearDown();
}
/**
* Defines aliases
*
@ -78,7 +50,6 @@ class BaseEnumRoutableTest extends TestCase
{
// phpcs:enable
return [
\Illuminate\Log\LogServiceProvider::class,
\Kwaadpepper\Enum\EnumServiceProvider::class,
];
}

View file

@ -10,7 +10,6 @@ use Kwaadpepper\Enum\Tests\Enums\DuplicatedLabels;
use Kwaadpepper\Enum\Tests\Enums\DuplicatedValues;
use Kwaadpepper\Enum\Tests\Enums\ForceStringsFromInteger;
use Kwaadpepper\Enum\Tests\Models\Report;
use Orchestra\Testbench\TestCase;
class BaseEnumTest extends TestCase
{

40
tests/TestCase.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace Kwaadpepper\Enum\Tests;
abstract class TestCase extends \Orchestra\Testbench\TestCase
{
/**
* Automatically loads environment file if available.
*
* @var boolean
*/
protected $loadEnvironmentVariables = false;
/**
* Setup custom phpunit catch for deprecated error cathing.
*
* @return void
*/
public function setUp(): void
{
set_error_handler(
static function ($errno, $errstr) {
throw new \Exception($errstr, $errno);
},
E_ALL
);
parent::setUp();
}
/**
* Restore phpunit handler
*
* @return void
*/
public function tearDown(): void
{
restore_error_handler();
parent::tearDown();
}
}