public function testExecution() { require_once __DIR__ . '/stubs/TestCommand.php'; require_once __DIR__ . '/stubs/TestCommandHandler.php'; $application = new \Illuminate\Foundation\Application(); $application->bind('config', function () { return new \Illuminate\Config\Repository(); }); $handler = new TestCommandHandler(); TestCommandHandler::$handledCommands = []; $application->singleton(TestCommandHandler::class, function () use(&$handler) { return $handler; }); $application->register(new TacticianServiceProvider($application)); $command = new TestCommand('data'); $application['tactician.dispatcher']->dispatch($command); $this->assertCount(1, TestCommandHandler::$handledCommands); $this->assertEquals($command, TestCommandHandler::$handledCommands[0]); }
public function testWithMiddleware() { require_once __DIR__ . '/stubs/TestCommand.php'; require_once __DIR__ . '/stubs/TestCommandHandler.php'; require_once __DIR__ . '/stubs/TestMiddleware.php'; $application = new \Illuminate\Foundation\Application(); $application->bind('config', function () { return new \Illuminate\Config\Repository(); }); $application->singleton(TestCommandHandler::class, function () use(&$handler) { return new TestCommandHandler(); }); $application->register(new TacticianServiceProvider($application)); $application['tactician.middleware']->prepend('test.middleware'); $middleware = new TestMiddleware(); $application->bind('test.middleware', function () use($middleware) { return $middleware; }); $command = new TestCommand('data'); $application['tactician.dispatcher']->dispatch($command); $this->assertCount(1, $middleware->handledCommands); $this->assertEquals($command, $middleware->handledCommands[0]); }
| 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__ . '/../')); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); $app->register('Jenssegers\\Mongodb\\MongodbServiceProvider'); /* |-------------------------------------------------------------------------- | 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;
| 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__ . '/../')); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); $app->register('App\\Providers\\SQLLoggerProvider'); /* |-------------------------------------------------------------------------- | 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;
| Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'Coyote\\Http\\Kernel'); $app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'Coyote\\Console\\Kernel'); $app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'Coyote\\Exceptions\\Handler'); /* | Load external plugins */ foreach (glob($app->path() . '/Plugins/*') as $dir) { if (is_dir($dir)) { $explode = explode('/', $dir); $app->register('Coyote\\Plugins\\' . end($explode) . '\\ServiceProvider'); } } /* |-------------------------------------------------------------------------- | 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;
| 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__ . '/../')); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); $app->register(SammyK\LaravelFacebookSdk\LaravelFacebookSdkServiceProvider::class); /* |-------------------------------------------------------------------------- | 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;
| 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__ . '/../')); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); /* |-------------------------------------------------------------------------- | 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. | */ $app->register(App\Api\v1\Providers\OauthServiceProvider::class); return $app;
| 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__ . '/../')); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'Vinil\\Http\\Kernel'); $app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'Vinil\\Console\\Kernel'); $app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'Vinil\\Exceptions\\Handler'); $app->register(Artisaninweb\SoapWrapper\ServiceProvider::class); /* |-------------------------------------------------------------------------- | 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;