/**
  * Get the root Facade application instance.
  *
  * @param  string  $make
  * @return mixed
  */
 function app($make = null)
 {
     if (!is_null($make)) {
         return app()->make($make);
     }
     return Illuminate\Support\Facades\Facade::getFacadeApplication();
 }
Пример #2
0
 /**
  * Bootstrap the test environemnt:
  * - Create an application instance and register it within itself.
  * - Register the package service provider with the app.
  * - Set the APP facade.
  *
  * @return void
  */
 public function setUp()
 {
     $app = new Illuminate\Foundation\Application();
     $app->instance('app', $app);
     $app->register('Codesleeve\\Stapler\\StaplerServiceProvider');
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
 }
Пример #3
0
 /**
  * Bootstrap the test environemnt:
  * - Create an application instance and register it within itself.
  * - Register the package service provider with the app.
  * - Set the APP facade.
  *
  * @return void
  */
 public function setUp()
 {
     $app = new Illuminate\Foundation\Application();
     $app->instance('app', $app);
     $app->register('Expstudio\\LaraClip\\LaraClipServiceProvider');
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
 }
 public function setUp()
 {
     parent::setUp();
     $app = m::mock('AppMock');
     $app->shouldReceive('instance')->once()->andReturn($app);
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
     Config::swap($config = m::mock('ConfigMock'));
 }
Пример #5
0
 protected function setupApplication()
 {
     $this->app = new Illuminate\Container\Container();
     Illuminate\Support\Facades\Facade::setFacadeApplication($this->app);
     $this->app['app'] = $this->app;
     $this->app['env'] = defined(LARAPRESS_ENV) ? LARAPRESS_ENV : 'development';
     with(new Illuminate\Events\EventServiceProvider($this->app))->register();
     with(new Illuminate\Routing\RoutingServiceProvider($this->app))->register();
 }
Пример #6
0
 public function setUp()
 {
     parent::setUp();
     $app = m::mock('AppMock');
     $app->shouldReceive('instance')->once()->andReturn($app);
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
     Illuminate\Support\Facades\Config::swap($config = m::mock('ConfigMock'));
     $config->shouldReceive('get')->once()->with('logviewer::log_dirs')->andReturn(array('app' => 'app/storage/logs'));
     $this->logviewer = new Logviewer('app', 'cgi-fcgi', '2013-06-01');
 }
Пример #7
0
 public function setUp()
 {
     $tmpConfig = (include 'config.php');
     $app = m::mock('AppMock');
     $app->shouldReceive('instance')->once()->andReturn($app);
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
     Illuminate\Support\Facades\Config::swap($config = m::mock('ConfigMock'));
     foreach ($tmpConfig as $key => $row) {
         $config->shouldReceive('get')->once()->with("smarty::{$key}")->andReturn($row);
     }
     $this->manager = new SmartyManager(m::mock('Illuminate\\View\\Engines\\EngineResolver'), m::mock('Illuminate\\View\\ViewFinderInterface'), m::mock('Illuminate\\Events\\Dispatcher'), new \Smarty());
 }
Пример #8
0
 /**
  * Create new instance of Bootioc
  */
 public function __construct()
 {
     //Register class loader
     Illuminate\Support\ClassLoader::register();
     //Create the IOC container
     $this->ioc = new Container();
     $this->ioc->bind('app', $this->ioc);
     Illuminate\Support\Facades\Facade::setFacadeApplication($this->ioc);
     //Execute TRegister
     $this->registerRepositories();
     //Add facades to classes
     $this->addFacades();
 }
 public function setUp()
 {
     parent::setUp();
     //Test parameters
     $this->params = ['_fields' => 'title,description,comments.title,user.first_name', 'title-lk' => 'Example Title|Another Title', 'title' => 'Example Title', 'title-not-lk' => 'Example Title', 'title-not' => 'Example Title|Another Title', 'id-min' => 5, 'id-max' => 6, 'id-gt' => 7, 'id-st' => 8, 'id-in' => '1,2', 'id-not-in' => '3,4', '_limit' => 5, '_offset' => 10, '_with' => 'comments.user', '_sort' => '-title,first_name,comments.created_at', '_config' => 'mode-default,meta-filter-count,meta-total-count'];
     $this->fulltextSelectExpression = new Expression('MATCH(title,description) AGAINST("Something to search" IN BOOLEAN MODE) as `_score`');
     //Test data
     $this->data = [['foo' => 'A1', 'bar' => 'B1'], ['foo' => 'A2', 'bar' => 'B2']];
     //Mock the application
     $app = m::mock('AppMock');
     $app->shouldReceive('instance')->once()->andReturn($app);
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
     //Mock the config
     $config = m::mock('ConfigMock');
     $config->shouldReceive('get')->once()->with('apihandler.prefix')->andReturn('_');
     $config->shouldReceive('get')->once()->with('apihandler.envelope')->andReturn(false);
     $config->shouldReceive('get')->once()->with('apihandler.fulltext')->andReturn('default');
     $config->shouldReceive('get')->once()->with('apihandler.fulltext')->andReturn('native');
     $config->shouldReceive('get')->once()->with('apihandler.fulltext_score_column')->andReturn('_score');
     Config::swap($config);
     $app->shouldReceive('make')->once()->andReturn($config);
     //Mock the input
     $input = m::mock('InputMock');
     $input->shouldReceive('get')->once()->with()->andReturn($this->params);
     Input::swap($input);
     //Mock the response
     $response = m::mock('ResponseMock');
     $response->shouldReceive('json')->once()->andReturn(new JsonResponse(['meta' => [], 'data' => new Collection()]));
     Response::swap($response);
     //Mock pdo
     $pdo = m::mock('PdoMock');
     $pdo->shouldReceive('quote')->once()->with('Something to search')->andReturn('Something to search');
     //Mock the connection the same way as laravel does:
     //tests/Database/DatabaseEloquentBuilderTest.php#L408-L418 (mockConnectionForModel($model, $database))
     $grammar = new Illuminate\Database\Query\Grammars\MySqlGrammar();
     $processor = new Illuminate\Database\Query\Processors\MySqlProcessor();
     $connection = m::mock('Illuminate\\Database\\ConnectionInterface', ['getQueryGrammar' => $grammar, 'getPostProcessor' => $processor]);
     $connection->shouldReceive('select')->once()->with('select * from `posts`', [])->andReturn($this->data);
     $connection->shouldReceive('select')->once()->with('select * from `posts`', [], true)->andReturn($this->data);
     $connection->shouldReceive('raw')->once()->with('MATCH(title,description) AGAINST("Something to search" IN BOOLEAN MODE) as `_score`')->andReturn($this->fulltextSelectExpression);
     $connection->shouldReceive('getPdo')->once()->andReturn($pdo);
     $resolver = m::mock('Illuminate\\Database\\ConnectionResolverInterface', ['connection' => $connection]);
     Post::setConnectionResolver($resolver);
     $this->apiHandler = new ApiHandler();
 }
 public function setUp()
 {
     Illuminate\Support\Facades\Facade::clearResolvedInstances();
 }
 public function setUp()
 {
     $app = m::mock('Application')->shouldReceive('make')->with('path.base')->andReturn('/foo/bar')->mock();
     Illuminate\Support\Facades\Facade::setFacadeApplication($app);
 }
Пример #12
0
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/illuminate/support/Illuminate/Support/helpers.php';
include __DIR__ . '/../app/Config/database.php';
$basePath = str_finish(dirname(__FILE__), '/');
$controllersDirectory = $basePath . '../app/src/Controllers';
$modelsDirectory = $basePath . '../app/src/Models';
$viewsDirectory = $basePath . '../app/Views';
$cacheDirectory = $basePath . '../app/Cache';
// register the autoloader and add directories
Illuminate\Support\ClassLoader::register();
Illuminate\Support\ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory));
// Instantiate the container
$app = new Illuminate\Container\Container();
// Tell facade about the application instance
Illuminate\Support\Facades\Facade::setFacadeApplication($app);
// register application instance with container
$app['app'] = $app;
// set environment
$app['env'] = 'production';
with(new Illuminate\Events\EventServiceProvider($app))->register();
with(new Illuminate\Routing\RoutingServiceProvider($app))->register();
include $basePath . '../Routes.php';
// Instantiate the request
$request = Illuminate\Http\Request::createFromGlobals();
if ($app['env'] == 'dev') {
    // Dispatch the router
    $response = $app['router']->dispatch($request);
    // Send the response
    $response->send();
} else {