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]); }
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]); }
| 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->bind(App\Doglove\Mascota\MascotaRepoInterface::class, App\Doglove\Mascota\MascotaRepo::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__ . '/..')); /* |-------------------------------------------------------------------------- | 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;
/** * Runs through all the bindings * @param Illuminate\Foundation\Application $app */ public function bindings($app) { $app->bind('CoandaCMS\\Coanda\\Urls\\Repositories\\UrlRepositoryInterface', 'CoandaCMS\\Coanda\\Urls\\Repositories\\Eloquent\\EloquentUrlRepository'); $search_provider = $this->config->get('coanda::coanda.search_provider'); if (class_exists($search_provider)) { $app->bind('CoandaCMS\\Coanda\\Search\\CoandaSearchProvider', $search_provider); } else { $app->bind('CoandaCMS\\Coanda\\Search\\CoandaSearchProvider', 'CoandaCMS\\Coanda\\Search\\Basic\\CoandaBasicSearchProvider'); } // Let the module output any bindings foreach ($this->modules as $module) { $module->bindings($app); } }
<?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__ . '/../')); //set the public path to this directory $app->bind('path.public', function () { return __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', 'Crockenhill\\Http\\Kernel'); $app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'Crockenhill\\Console\\Kernel'); $app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'Crockenhill\\Exceptions\\Handler'); /*
| 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->bind('App\\Http\\Middleware\\JSONMiddleware', 'App\\Http\\Middleware\\JSONMiddleware'); $app->alias('App\\Http\\Middleware\\JSONMiddleware', 'json'); /* |-------------------------------------------------------------------------- | 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;
<?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. | */ error_reporting(error_reporting() & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED); $app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../')); $app->bind('path.public', function () { return realpath(__DIR__ . '/../../static'); }); /* |-------------------------------------------------------------------------- | 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, YCMS\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, YCMS\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, YCMS\Exceptions\Handler::class); /*
| 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->bind('\\App\\Repositories\\BookRepositoryInterface', '\\App\\Repositories\\BookRepository'); /* |-------------------------------------------------------------------------- | 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;
<?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__ . '/../')); $app->bind('path.public', function () { return __DIR__ . '/../../public_html/donde-laravel'; }); /* |-------------------------------------------------------------------------- | 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', 'App\\Http\\Kernel'); $app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'App\\Console\\Kernel'); $app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'App\\Exceptions\\Handler'); /* |--------------------------------------------------------------------------
| 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, CurrencyConverter\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, CurrencyConverter\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, CurrencyConverter\Exceptions\Handler::class); /* |-------------------------------------------------------------------------- | Bind Custom Interfaces |-------------------------------------------------------------------------- | | @see http://laravel.com/docs/5.1/container | */ $app->bind(CurrencyConverter\Libraries\CurrencyRateApi\Client\Client::class, CurrencyConverter\Libraries\CurrencyRateApi\Client\ECPClient::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;
| 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); /* |-------------------------------------------------------------------------- | Bind the Public Path |-------------------------------------------------------------------------- | | On shared hostings we want to change the public path. As this | is somewhat hardcoded in the $app->publicPath method we give | the option to set an env constant to change this if necessary | */ $app->bind('path.public', function (Illuminate\Foundation\Application $app) { // don't ask - in some cases the config is not yet fully loaded at this point return $app->config->get('typicms.public_path') ?: env('PUBLIC_PATH') ?: $app->publicPath(); }); /* |-------------------------------------------------------------------------- | 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;
<?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__ . '/../')); // Let us make the public directory configurable $app->bind('path.public', function () { return base_path(env('PUBLIC_DIR', 'public_html')); }); /* |-------------------------------------------------------------------------- | 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, Reactor\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, Reactor\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, Reactor\Exceptions\Handler::class); /*
| 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, Netwerven\Test\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, Netwerven\Test\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, Netwerven\Test\Exceptions\Handler::class); $app->bind(\Netwerven\Test\Repositories\VacancyRepositoryInterface::class, \Netwerven\Test\Repositories\VacancyRepository::class); $app->bind(\Netwerven\Test\VacancyInterface::class, \Netwerven\Test\Vacancy::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;
<?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__ . '/../')); $app->bind('path.public', function () { return base_path() . '/public_html'; }); /* |-------------------------------------------------------------------------- | 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); /* |--------------------------------------------------------------------------
| 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->bind('path.public', function () { return base_path(); }); return $app;
<?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__ . '/../')); $app->bind('path.public', function () { // @see config/app.pgp [public_path] return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public_html'; }); /* |-------------------------------------------------------------------------- | 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); /*