示例#1
0
 /**
  * @test
  */
 public function shouldHandleApcQueryCache()
 {
     if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) {
         $this->markTestSkipped('APC extension is not loaded.');
     }
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcCache());
     $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcCache());
     $config->setProxyDir(__DIR__);
     $config->setProxyNamespace('Gedmo\\Mapping\\Proxy');
     $config->getAutoGenerateProxyClasses(false);
     $config->setMetadataDriverImpl($this->getMetadataDriverImplementation());
     $conn = array('driver' => 'pdo_sqlite', 'memory' => true);
     $em = \Doctrine\ORM\EntityManager::create($conn, $config);
     $schema = array_map(function ($class) use($em) {
         return $em->getClassMetadata($class);
     }, (array) $this->getUsedEntityFixtures());
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $schemaTool->dropSchema(array());
     $schemaTool->createSchema($schema);
     $this->populate($em);
     $_GET['filterField'] = 'a.title';
     $_GET['filterValue'] = 'summer';
     $query = $em->createQuery('SELECT a FROM Test\\Fixture\\Entity\\Article a');
     $p = new Paginator();
     $view = $p->paginate($query, 1, 10);
     $query = $em->createQuery('SELECT a FROM Test\\Fixture\\Entity\\Article a');
     $view = $p->paginate($query, 1, 10);
 }