Ejemplo n.º 1
0
 /**
  * @test
  * @testdox Loader is called with each new context after pooling is disabled (ignores duplicates)
  */
 public function loaderCalledForEveryNewContextIgnoringDuplicatesWhenPoolingIsDisabled()
 {
     $renderer = $this->generator->createAbstractRendererMock();
     $this->manager->registerRenderer('default', $renderer);
     $loaderA = $this->generator->createAbstractLoaderMock();
     $loaderA->expects($this->never())->method('single');
     $loaderA->expects($this->once())->method('batch');
     $loaderB = $this->generator->createAbstractLoaderMock();
     $loaderB->expects($this->once())->method('single');
     $loaderB->expects($this->never())->method('batch');
     $this->manager->registerLoader('default', $loaderA);
     $this->manager->registerLoader('development', $loaderB);
     $this->manager->addRegionContexts([new RegionContext('some-id-1', 'default', 'default'), new RegionContext('some-id-2', 'default', 'default'), new RegionContext('some-id-3', 'development', 'default'), new RegionContext('some-id-4', 'development', 'default')]);
     $this->manager->render('some-id-1');
     //  The duplicates should not hit the loaders.
     $this->manager->addRegionContexts([new RegionContext('some-id-1', 'default', 'default'), new RegionContext('some-id-4', 'development', 'default'), new RegionContext('some-id-5', 'development', 'development')]);
     //  Attempting a single duplicate.
     $this->manager->addRegionContext(new RegionContext('some-id-1', 'default', 'default'));
 }