/**
  * Stop collecting at the end of a request
  *
  * @param \Symfony\Component\HttpKernel\Event\PostResponseEvent $event
  */
 public function onKernelTerminate(PostResponseEvent $event)
 {
     if (!$this->driver || !$this->repository->isEnabled()) {
         return;
     }
     $coverage = $this->driver->stop();
     $this->repository->addCoverage($coverage);
 }
 public function testAddCoverage()
 {
     $coverage = array('test' => array(1 => 1));
     $proxy = $this->getMock('VIPSoft\\Test\\FunctionProxy');
     $proxy->expects($this->once())->method('invokeFunction')->with("INSERT INTO coverage (class, counts) VALUES ('test', '{\"1\":1}')");
     \VIPSoft\CodeCoverageBundle\Test\SQLite3::$proxiedMethods['exec'] = array($proxy, 'invokeFunction');
     $repository = new CodeCoverageRepository($this->databaseConfig, $this->databaseDirectory, $this->sqlite);
     $repository->addCoverage($coverage);
 }