Large refactor of HTTP and Console stack.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace App\Console;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
41
app/Console/Kernel.php
Normal file
41
app/Console/Kernel.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php namespace App\Console;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bootstrap classes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected $bootstrappers = [
|
||||||
|
'Illuminate\Foundation\Bootstrap\LoadEnvironment',
|
||||||
|
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||||
|
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||||
|
'Illuminate\Foundation\Bootstrap\BootProviders',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the console application.
|
||||||
|
*
|
||||||
|
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||||
|
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle($input, $output = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return parent::handle($input, $output);
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$output->writeln((string) $e);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
54
app/Http/Kernel.php
Normal file
54
app/Http/Kernel.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php namespace App\Http;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bootstrap classes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected $bootstrappers = [
|
||||||
|
'Illuminate\Foundation\Bootstrap\LoadEnvironment',
|
||||||
|
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||||
|
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||||
|
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||||
|
'Illuminate\Foundation\Bootstrap\BootProviders',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $stack = [
|
||||||
|
'App\Http\Middleware\MaintenanceMiddleware',
|
||||||
|
'Illuminate\Cookie\Middleware\Guard',
|
||||||
|
'Illuminate\Cookie\Middleware\Queue',
|
||||||
|
'Illuminate\Session\Middleware\Reader',
|
||||||
|
'Illuminate\Session\Middleware\Writer',
|
||||||
|
'Illuminate\View\Middleware\ErrorBinder',
|
||||||
|
'App\Http\Middleware\CsrfMiddleware',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming HTTP request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function handle($request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return parent::handle($request);
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<?php namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Routing\Router;
|
|
||||||
use Illuminate\Routing\Stack\Builder as Stack;
|
|
||||||
use Illuminate\Foundation\Support\Providers\AppServiceProvider as ServiceProvider;
|
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All of the application's route middleware keys.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middleware = [
|
|
||||||
'auth' => 'App\Http\Middleware\AuthMiddleware',
|
|
||||||
'auth.basic' => 'App\Http\Middleware\BasicAuthMiddleware',
|
|
||||||
'csrf' => 'App\Http\Middleware\CsrfMiddleware',
|
|
||||||
'guest' => 'App\Http\Middleware\GuestMiddleware',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application's middleware stack.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $stack = [
|
|
||||||
'App\Http\Middleware\MaintenanceMiddleware',
|
|
||||||
'Illuminate\Cookie\Middleware\Guard',
|
|
||||||
'Illuminate\Cookie\Middleware\Queue',
|
|
||||||
'Illuminate\Session\Middleware\Reader',
|
|
||||||
'Illuminate\Session\Middleware\Writer',
|
|
||||||
'Illuminate\View\Middleware\ErrorBinder',
|
|
||||||
'App\Http\Middleware\CsrfMiddleware',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the application stack based on the provider properties.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function stack()
|
|
||||||
{
|
|
||||||
$this->app->stack(function(Stack $stack, Router $router)
|
|
||||||
{
|
|
||||||
return $stack
|
|
||||||
->middleware($this->stack)->then(function($request) use ($router)
|
|
||||||
{
|
|
||||||
return $router->dispatch($request);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,7 @@ class ArtisanServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->commands('App\Console\InspireCommand');
|
$this->commands('App\Console\Commands\InspireCommand');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +29,7 @@ class ArtisanServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function provides()
|
public function provides()
|
||||||
{
|
{
|
||||||
return ['App\Console\InspireCommand'];
|
return ['App\Console\Commands\InspireCommand'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
<?php namespace App\Providers;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Contracts\Logging\Log;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Contracts\Exception\Handler;
|
|
||||||
|
|
||||||
class ErrorServiceProvider extends ServiceProvider {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any error handlers.
|
|
||||||
*
|
|
||||||
* @param Handler $handler
|
|
||||||
* @param Log $log
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot(Handler $handler, Log $log)
|
|
||||||
{
|
|
||||||
// Here you may handle any errors that occur in your application, including
|
|
||||||
// logging them or displaying custom views for specific errors. You may
|
|
||||||
// even register several error handlers to handle different types of
|
|
||||||
// exceptions. If nothing is returned, the default error view is
|
|
||||||
// shown, which includes a detailed stack trace during debug.
|
|
||||||
$handler->error(function(Exception $e) use ($log)
|
|
||||||
{
|
|
||||||
$log->error($e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the service provider.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -5,13 +5,6 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvi
|
|||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider {
|
class RouteServiceProvider extends ServiceProvider {
|
||||||
|
|
||||||
/**
|
|
||||||
* The root namespace to assume when generating URLs to actions.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $rootUrlNamespace = 'App\Http\Controllers';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controllers to scan for route annotations.
|
* The controllers to scan for route annotations.
|
||||||
*
|
*
|
||||||
@@ -23,6 +16,18 @@ class RouteServiceProvider extends ServiceProvider {
|
|||||||
'App\Http\Controllers\Auth\PasswordController',
|
'App\Http\Controllers\Auth\PasswordController',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All of the application's route middleware keys.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
'auth' => 'App\Http\Middleware\AuthMiddleware',
|
||||||
|
'auth.basic' => 'App\Http\Middleware\BasicAuthMiddleware',
|
||||||
|
'csrf' => 'App\Http\Middleware\CsrfMiddleware',
|
||||||
|
'guest' => 'App\Http\Middleware\GuestMiddleware',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before routes are registered.
|
* Called before routes are registered.
|
||||||
*
|
*
|
||||||
|
|||||||
25
artisan
25
artisan
@@ -27,23 +27,7 @@ require __DIR__.'/bootstrap/autoload.php';
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app = require_once __DIR__.'/bootstrap/start.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Load The Artisan Console Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| We'll need to run the script to load and return the Artisan console
|
|
||||||
| application. We keep this in its own script so that we will load
|
|
||||||
| the console application independent of running commands which
|
|
||||||
| will allow us to fire commands from Routes when we want to.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app->setRequestForConsoleEnvironment();
|
|
||||||
|
|
||||||
$artisan = Illuminate\Console\Application::start($app);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -56,7 +40,10 @@ $artisan = Illuminate\Console\Application::start($app);
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$status = $artisan->run();
|
$status = $app->make('Illuminate\Contracts\Console\Kernel')->handle(
|
||||||
|
new Symfony\Component\Console\Input\ArgvInput,
|
||||||
|
new Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -69,6 +56,4 @@ $status = $artisan->run();
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app->shutdown();
|
|
||||||
|
|
||||||
exit($status);
|
exit($status);
|
||||||
|
|||||||
50
bootstrap/app.php
Normal file
50
bootstrap/app.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
realpath(__DIR__.'/..')
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app->bind(
|
||||||
|
'Illuminate\Contracts\Http\Kernel',
|
||||||
|
'App\Http\Kernel'
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->bind(
|
||||||
|
'Illuminate\Contracts\Console\Kernel',
|
||||||
|
'App\Console\Kernel'
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Return The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
||||||
@@ -33,19 +33,3 @@ if (file_exists($compiledPath))
|
|||||||
{
|
{
|
||||||
require $compiledPath;
|
require $compiledPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Register The Workbench Loaders
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The Laravel workbench provides a convenient place to develop packages
|
|
||||||
| when working locally. However we will need to load in the Composer
|
|
||||||
| auto-load files for the packages so that these can be used here.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (is_dir($workbench = __DIR__.'/../workbench'))
|
|
||||||
{
|
|
||||||
Illuminate\Workbench\Starter::start($workbench);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Load Environment Variables
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Next we will load the environment variables for the application which
|
|
||||||
| are stored in the ".env" file. These variables will be loaded into
|
|
||||||
| the $_ENV and "putenv" facilities of PHP so they stay available.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (file_exists(__DIR__.'/../.env'))
|
|
||||||
{
|
|
||||||
Dotenv::load(__DIR__.'/../');
|
|
||||||
|
|
||||||
//Dotenv::required('APP_ENV');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Detect The Application Environment
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Laravel takes a dead simple approach to your application environments
|
|
||||||
| so you may simply return the environment from the Closure. We will
|
|
||||||
| assume we are using the "APP_ENV" variable for this environment.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$env = $app->detectEnvironment(function()
|
|
||||||
{
|
|
||||||
return getenv('APP_ENV') ?: 'production';
|
|
||||||
});
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here we just defined the path to the application directory. Most likely
|
|
||||||
| you will never need to change this value as the default setup should
|
|
||||||
| work perfectly fine for the vast majority of all our applications.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'app' => __DIR__.'/../app',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Base Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The base path is the root of the Laravel installation. Most likely you
|
|
||||||
| will not need to change this value. But, if for some wild reason it
|
|
||||||
| is necessary you will do so here, just proceed with some caution.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'base' => __DIR__.'/..',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Configuration Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This path is used by the configuration loader to load the application
|
|
||||||
| configuration files. In general, you should'nt need to change this
|
|
||||||
| value; however, you can theoretically change the path from here.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'config' => __DIR__.'/../config',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Database Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This path is used by the migration generator and migration runner to
|
|
||||||
| know where to place your fresh database migration classes. You're
|
|
||||||
| free to modify the path but you probably will not ever need to.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'database' => __DIR__.'/../database',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Language Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This path is used by the language file loader to load your application
|
|
||||||
| language files. The purpose of these files is to store your strings
|
|
||||||
| that are translated into other languages for views, e-mails, etc.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'lang' => __DIR__.'/../resources/lang',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Public Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The public path contains the assets for your web application, such as
|
|
||||||
| your JavaScript and CSS files, and also contains the primary entry
|
|
||||||
| point for web requests into these applications from the outside.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'public' => __DIR__.'/../public',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Storage Path
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The storage path is used by Laravel to store cached Blade views, logs
|
|
||||||
| and other pieces of information. You may modify the path here when
|
|
||||||
| you want to change the location of this directory for your apps.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'storage' => __DIR__.'/../storage',
|
|
||||||
|
|
||||||
];
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Create The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The first thing we will do is create a new Laravel application instance
|
|
||||||
| which serves as the "glue" for all the components of Laravel, and is
|
|
||||||
| the IoC container for the system binding all of the various parts.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application;
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Detect The Application Environment
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Laravel takes a dead simple approach to your application environments
|
|
||||||
| so you can just specify a machine name for the host that matches a
|
|
||||||
| given environment, then we will automatically detect it for you.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
require __DIR__.'/environment.php';
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Bind Paths
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here we are binding the paths configured in paths.php to the app. You
|
|
||||||
| should not be changing these here. If you need to change these you
|
|
||||||
| may do so within the paths.php file and they will be bound here.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app->bindInstallPaths(require __DIR__.'/paths.php');
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Load The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here we will load this Illuminate application. We will keep this in a
|
|
||||||
| separate location so we can isolate the creation of an application
|
|
||||||
| from the actual running of the application with a given request.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$framework = $app['path.base'].
|
|
||||||
'/vendor/laravel/framework/src';
|
|
||||||
|
|
||||||
require $framework.'/Illuminate/Foundation/start.php';
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Return The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This script returns the application instance. The instance is given to
|
|
||||||
| the calling script so we can separate the building of the instances
|
|
||||||
| from the actual running of the application and sending responses.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $app;
|
|
||||||
@@ -98,9 +98,7 @@ return [
|
|||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
*/
|
*/
|
||||||
'App\Providers\AppServiceProvider',
|
|
||||||
'App\Providers\ArtisanServiceProvider',
|
'App\Providers\ArtisanServiceProvider',
|
||||||
'App\Providers\ErrorServiceProvider',
|
|
||||||
'App\Providers\EventServiceProvider',
|
'App\Providers\EventServiceProvider',
|
||||||
'App\Providers\LogServiceProvider',
|
'App\Providers\LogServiceProvider',
|
||||||
'App\Providers\RouteServiceProvider',
|
'App\Providers\RouteServiceProvider',
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ return [
|
|||||||
|
|
||||||
'files' => [
|
'files' => [
|
||||||
|
|
||||||
__DIR__.'/../app/Providers/AppServiceProvider.php',
|
|
||||||
__DIR__.'/../app/Providers/ArtisanServiceProvider.php',
|
__DIR__.'/../app/Providers/ArtisanServiceProvider.php',
|
||||||
__DIR__.'/../app/Providers/ErrorServiceProvider.php',
|
|
||||||
__DIR__.'/../app/Providers/EventServiceProvider.php',
|
__DIR__.'/../app/Providers/EventServiceProvider.php',
|
||||||
__DIR__.'/../app/Providers/LogServiceProvider.php',
|
__DIR__.'/../app/Providers/LogServiceProvider.php',
|
||||||
__DIR__.'/../app/Providers/RouteServiceProvider.php',
|
__DIR__.'/../app/Providers/RouteServiceProvider.php',
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
syntaxCheck="false"
|
syntaxCheck="false">
|
||||||
>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Application Test Suite">
|
<testsuite name="Application Test Suite">
|
||||||
<directory>./tests/</directory>
|
<directory>./tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
<php>
|
||||||
|
<env name="APP_ENV" value="testing"/>
|
||||||
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ require __DIR__.'/../bootstrap/autoload.php';
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app = require_once __DIR__.'/../bootstrap/start.php';
|
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -46,4 +46,8 @@ $app = require_once __DIR__.'/../bootstrap/start.php';
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app->run();
|
$response = $app->make('Illuminate\Contracts\Http\Kernel')->handle(
|
||||||
|
Illuminate\Http\Request::capture()
|
||||||
|
);
|
||||||
|
|
||||||
|
$response->send();
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ class ExampleTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public function testBasicExample()
|
public function testBasicExample()
|
||||||
{
|
{
|
||||||
$crawler = $this->client->request('GET', '/');
|
$response = $this->call('GET', '/');
|
||||||
|
|
||||||
$this->assertTrue($this->client->getResponse()->isOk());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,11 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase {
|
|||||||
/**
|
/**
|
||||||
* Creates the application.
|
* Creates the application.
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
|
* @return \Illuminate\Foundation\Application
|
||||||
*/
|
*/
|
||||||
public function createApplication()
|
public function createApplication()
|
||||||
{
|
{
|
||||||
$unitTesting = true;
|
return require __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
$testEnvironment = 'testing';
|
|
||||||
|
|
||||||
return require __DIR__.'/../bootstrap/start.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user