/** * Handle a request. * * @param SyfmonyRequest $request * @param int $type * @param bool $catch * @return Response */ public function handle(SyfmonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) { $request = Request::createFromBase($request); $request->enableHttpMethodParameterOverride(); $this->app->bind('request', $request); return $this->httpKernel->handle($request); }
/** * Setup the test. */ protected function setUp() { parent::setUp(); $this->app = new Application(); $this->app->bind('config', function () { return new Repository(['inliner' => ['paths' => ['stylesheets' => ['some/path/n/stuff']], 'options' => ['cleanup' => false, 'use_inline_styles_block' => false, 'strip_original_tags' => false, 'exclude_media_queries' => false]]]); }); }
/** * Apply the registered Laravel service container bindings. */ private function applyBindings() { foreach ($this->bindings as $abstract => $binding) { list($concrete, $shared) = $binding; $this->app->bind($abstract, $concrete, $shared); } }
protected function getApplication($customConfig = []) { $app = new Application(); $app->instance('path', __DIR__); $app['env'] = 'production'; $app['path.config'] = $this->root . '/config'; // Filesystem $files = m::mock('Illuminate\\Filesystem\\Filesystem'); $app['files'] = $files; // View // $finder = m::mock('Illuminate\View\ViewFinderInterface'); // $finder->shouldReceive('addExtension'); // $app['view'] = new Factory( // new EngineResolver(), // $finder, // m::mock('Illuminate\Events\Dispatcher') // ); // $config_data = include $config_file; // Config $app['config'] = new Repository([]); $app->bind('\\Illuminate\\Config\\Repository', function () use($app) { return $app['config']; }); return $app; }
/** * Define environment setup. * * @param \Illuminate\Foundation\Application $app * @return void */ protected function getEnvironmentSetUp($app) { $app->bind('Tokenly\\XCPDClient\\Client', function () { $client = m::mock('Tokenly\\XCPDClient\\Client'); $client->shouldReceive('get_asset_info')->with(['assets' => ['LTBCOIN']])->andReturn([$this->sampleLTBCoinAssetInfo()]); return $client; }); }
/** @test */ public function it_composes_a_view_using_each_view_composer() { $view = 'view.test'; $this->app->bind('Coderabbi\\Virtuoso\\Tests\\ComposerStub', function () { $composer = new ComposerStub(); $this->composers[] = $composer; return $composer; }); $compositeComposer = new CompositeComposerStub($this->app); $compositeComposer->setComposers(['Coderabbi\\Virtuoso\\Tests\\ComposerStub', 'Coderabbi\\Virtuoso\\Tests\\ComposerStub']); $compositeComposer->compose($view); // Should create two composers $this->assertEquals(2, count($this->composers)); // Each composer should compose $view foreach ($this->composers as $composer) { $this->assertEquals($view, $composer->composedView); } }
/** * Define environment setup. * * @param \Illuminate\Foundation\Application $app * @return void */ protected function getEnvironmentSetUp($app) { $app->bind('Tokenly\\XCPDClient\\Client', function () { $connection_string = getenv('XCPD_CONNECTION_STRING'); $rpc_user = getenv('XCPD_RPC_USER'); $rpc_password = getenv('XCPD_RPC_PASSWORD'); $client = new \Tokenly\XCPDClient\Client($connection_string, $rpc_user, $rpc_password); return $client; }); }
/** * Define environment setup. * * @param \Illuminate\Foundation\Application $app * @return void */ protected function getEnvironmentSetUp($app) { // Setup default database to use sqlite :memory: $app['config']->set('database.default', 'testbench'); $app['config']->set('database.connections.testbench', ['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '']); // Bind the stub tracker $app->bind(StubTracker::class, function ($app) { return new StubTracker($app, $app['events'], $app['config']); }); $app[StubTracker::class]->registerRoute($app['router']); parent::getEnvironmentSetUp($app); }
/** * Define environment setup. * * @param \Illuminate\Foundation\Application $app * * @return void */ protected function getEnvironmentSetUp($app) { // Set Testing Configuration $app['config']->set('database.default', 'testbench'); $app['config']->set('database.connections.testbench', ['driver' => 'sqlite', 'database' => __DIR__ . '/_data/database.sqlite', 'prefix' => '']); $app['config']->set('mail.pretend', true); $app['config']->set('mail.from', ['from' => '*****@*****.**', 'name' => null]); // Temporary Repository Bindings // Bind the Transaction Repository $app->bind('SRLabs\\Groundwork\\Repositories\\Transactions\\TransactionRepositoryInterface', function ($app) { return new EloquentTransactionRepository(new Transaction(), $app->make('cache.store'), $app->make('events'), $app->make('log')); }); }
/** * Register a binding with the container. * * @param string|array $abstract * @param \Closure|string|null $concrete * @param bool $shared * @return void * @static */ public static function bind($abstract, $concrete = null, $shared = false) { //Method inherited from \Illuminate\Container\Container \Illuminate\Foundation\Application::bind($abstract, $concrete, $shared); }
/** * @param Application $app */ protected function bindClasses($app) { $app->bind(TagVersionManagerInterface::class, TagVersionManager::class); $app->bind(TagVersionStorageInterface::class, function () use($app) { return new PlainRedisTagVersionStorage($app['redis'], 'test_connection', 'tag_test'); }); $app->bind(SerializerInterface::class, GenericSerializer::class); $app->bind(CoderManagerInterface::class, GenericCoderManager::class); }
/** * Define environment setup. * * @param \Illuminate\Foundation\Application $app * @return void */ protected function getEnvironmentSetUp($app) { $app->bind('Reloquent\\Contracts\\ReloquentClientContract', function ($app) { return new Reloquent\Test\ReloquentClientMock(); }); }
/** * @param \Illuminate\Foundation\Application $app * @return mixed */ public function bindings(\Illuminate\Foundation\Application $app) { $app->bind('CoandaCMS\\Coanda\\Pages\\Repositories\\PageRepositoryInterface', 'CoandaCMS\\Coanda\\Pages\\Repositories\\Eloquent\\EloquentPageRepository'); }
/** * @param Application $app * @return mixed */ public function bindings(Application $app) { $app->bind('CoandaCMS\\Coanda\\Media\\Repositories\\MediaRepositoryInterface', 'CoandaCMS\\Coanda\\Media\\Repositories\\Eloquent\\EloquentMediaRepository'); }
/** * Resolve application implementation. * * @return \Illuminate\Foundation\Application */ protected function resolveApplication() { $app = new Application($this->getBasePath()); $app->bind('Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Orchestra\\Testbench\\Bootstrap\\LoadConfiguration'); return $app; }
/** * Binds inert middleware to standard API middleware not included in this package. * * @param Application $app */ protected function bindNullMiddleware(Application $app) { $app->bind(\Czim\CmsAuth\Http\Middleware\Api\OAuthMiddleware::class, \Czim\CmsCore\Test\Http\NullMiddleware::class); $app->bind(\Czim\CmsAuth\Http\Middleware\Api\OAuthUserOwnerMiddleware::class, \Czim\CmsCore\Test\Http\NullMiddleware::class); }
/** * @param \Illuminate\Foundation\Application $app */ private function setUpHttpKernel($app) { $app->instance('request', (new \Illuminate\Http\Request())->instance()); $app->make('Illuminate\\Foundation\\Http\\Kernel', [$app, $this->getRouter()])->bootstrap(); $app->bind('Illuminate\\Contracts\\Debug\\ExceptionHandler', new \NilPortugues\Tests\App\Exceptions\Handler(new NullLogger())); }
/** * Register a binding with the container. * * @param string|array $abstract * @param \Closure|string|null $concrete * @param bool $shared */ public function bind($abstract, $concrete = null, $shared = false) { $this->app->bind($abstract, $concrete, $shared); }