collect() public method

public collect ( Request $request, Response $response, Exception $exception = null )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
$exception Exception
 public function testCollect()
 {
     $collector1 = $this->getMock('\\Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface');
     $nameCollector1 = 'collector1';
     $collector1->expects($this->once())->method('getName')->will($this->returnValue($nameCollector1));
     $collector2 = $this->getMock('\\Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface');
     $nameCollector2 = 'collector2';
     $collector2->expects($this->once())->method('getName')->will($this->returnValue($nameCollector2));
     $allCollectors = [$nameCollector1 => $collector1, $nameCollector2 => $collector2];
     $request = new Request();
     $response = new Response();
     $exception = new Exception();
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
     foreach ($allCollectors as $name => $collector) {
         $this->mainCollector->addCollector($collector);
         $collector->expects($this->once())->method('collect')->with($request, $response, $exception);
     }
     $this->mainCollector->collect($request, $response, $exception);
 }