Beispiel #1
0
 public function test_filters_get_registerd_on_boot()
 {
     $this->registry->shouldReceive('getManagers')->andReturn(['default' => $this->em]);
     $this->em->shouldReceive('getEventManager')->once()->andReturn($this->evm);
     $this->em->shouldReceive('getConfiguration')->once()->andReturn($this->configuration);
     $this->configuration->shouldReceive('getMetadataDriverImpl')->once()->andReturn($this->driver);
     $this->driver->shouldReceive('getReader')->once()->andReturn($this->reader);
     $collection = m::mock(FilterCollection::class);
     $this->configuration->shouldReceive('addFilter')->once()->with('filter', 'FilterMock');
     $this->configuration->shouldReceive('addFilter')->once()->with('filter2', 'FilterMock');
     $this->em->shouldReceive('getFilters')->twice()->andReturn($collection);
     $collection->shouldReceive('enable')->once()->with('filter');
     $collection->shouldReceive('enable')->once()->with('filter2');
     // Register
     $this->manager->register(new ExtensionWithFiltersMock());
     $this->manager->boot();
     // Should be inside booted extensions now
     $booted = $this->manager->getBootedExtensions();
     $this->assertTrue($booted['default']['ExtensionWithFiltersMock']);
 }
 /**
  * @param \Illuminate\Http\Request $request
  * @param Closure                  $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $this->manager->boot();
     return $next($request);
 }