Skip to content

Commit

Permalink
Add Kernel For TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
DyanGalih committed Jun 7, 2020
1 parent 0a514ce commit 143a46c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Kernel/Http/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Created by PhpStorm.
*/

namespace DyanGalih\DDD\Kernel\Http;

use WebAppId\User\Middleware\RoleCheck;

/**
* @author: Dyan Galih<[email protected]>
* Date: 01/06/2020
* Time: 10.47
* Class Kernel
* @package DyanGalih\Payment\Kernel
*/
class Kernel extends \Orchestra\Testbench\Http\Kernel
{
protected $routeMiddleware = [
'role' => RoleCheck::class,
'auth' => \Orchestra\Testbench\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \Orchestra\Testbench\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
12 changes: 12 additions & 0 deletions src/Traits/TestCaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Faker\Factory as Faker;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Artisan;
use WebAppId\User\Models\User;

Expand Down Expand Up @@ -91,4 +92,15 @@ protected function resultLog(string $result){
error_log('Sample Result : ' . $result);
error_log('==========================================================');
}

/**
* Resolve application HTTP Kernel implementation.
*
* @param Application $app
* @return void
*/
protected function resolveApplicationHttpKernel($app)
{
$app->singleton('Illuminate\Contracts\Http\Kernel', 'WebAppId\DDD\Kernel\Http\Kernel');
}
}

0 comments on commit 143a46c

Please sign in to comment.