/**
  * @test
  */
 public function it_should_bind_index()
 {
     /**
      * Set
      */
     App::clearResolvedInstances();
     App::shouldReceive('make')->with('menthol.flexible.index', m::any())->once()->andReturn('mock');
     App::shouldReceive('make')->with('Elasticsearch')->twice()->andReturn('mock');
     $config = m::mock('Menthol\\Flexible\\Config');
     App::shouldReceive('make')->with('Menthol\\Flexible\\Config')->once()->andReturn($config);
     $config->shouldReceive('get')->with('elasticsearch.index_prefix', '')->andReturn('');
     $model = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $model->shouldReceive('getTable')->once()->andReturn('mockType');
     $app = m::mock('LaravelApp');
     $proxy = m::mock('Menthol\\Flexible\\Proxy', [$model]);
     $sp = m::mock('Menthol\\Flexible\\FlexibleServiceProvider[bindIndex]', [$app]);
     /**
      * Expectation
      */
     $app->shouldReceive('bind')->once()->andReturnUsing(function ($name, $closure) use($app, $proxy) {
         $this->assertEquals('menthol.flexible.index', $name);
         $this->assertInstanceOf('Menthol\\Flexible\\Index', $closure($app, ['proxy' => $proxy, 'name' => 'name']));
     });
     /**
      * Assertion
      */
     $sp->bindIndex();
 }
 public function tearDown()
 {
     App::clearResolvedInstances();
     parent::tearDown();
 }
Ejemplo n.º 3
0
 /**
  * Force destroy the container
  *
  * WARNING: Avoid using this, unless you really need to
  * destroy the IoC!
  */
 public function destroy()
 {
     $this->container = null;
     App::clearResolvedInstances();
     App::setFacadeApplication(null);
     self::$instance = null;
 }
Ejemplo n.º 4
0
 /**
  * Destroy the Inversion of Control (IoC) Container
  */
 public static function destroy()
 {
     App::clearResolvedInstances();
     App::setFacadeApplication(null);
     self::setContainer(null);
 }