Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed Aug 23, 2021
1 parent 569ce2e commit ce58aae
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/integration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use A17\Twill\AuthServiceProvider;
use A17\Twill\Models\User;
use App\Exceptions\SnAppException;
use A17\Twill\RouteServiceProvider;
use A17\Twill\Tests\Integration\Behaviors\CopyBlocks;
use A17\Twill\TwillServiceProvider;
Expand All @@ -17,6 +18,7 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

abstract class TestCase extends OrchestraTestCase
{
Expand Down Expand Up @@ -122,6 +124,8 @@ public function setUp(): void
$this->copyBlocks();

$this->installTwill();

$this->ensureAppExceptionHandlerExists();
}

/**
Expand Down Expand Up @@ -761,4 +765,14 @@ public function migrate()
public function loadConfig()
{
}

public function ensureAppExceptionHandlerExists()
{
$stubPath = __DIR__.'/../../tests/stubs/classes/AppExceptionHandler.php';
$filePath = __DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Exceptions/Handler.php';

if (!file_exists($filePath)) {
file_put_contents($filePath, file_get_contents($stubPath));
}
}
}
41 changes: 41 additions & 0 deletions tests/stubs/classes/AppExceptionHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

0 comments on commit ce58aae

Please sign in to comment.