Exemplo n.º 1
0
 public function testSimpleCountSql()
 {
     $con = \Propel\Runtime\Propel::getConnection();
     $con->useDebug(true);
     $exec = QuerycacheTable1Query::create()->count($con);
     $expectedSql = $this->getSql("SELECT COUNT(*) FROM querycache_table1");
     $renderedSql = \Propel\Runtime\Propel::getConnection()->getLastExecutedQuery();
     $this->assertEquals($expectedSql, $renderedSql);
 }
Exemplo n.º 2
0
 public function testCacheGeneratedSql()
 {
     $q = QuerycacheTable1Query::create()->setQueryKey('test2')->filterByTitle('bar');
     $exec = $q->find();
     $expectedSql = $this->getSql("SELECT querycache_table1.ID, querycache_table1.TITLE FROM `querycache_table1` WHERE querycache_table1.TITLE=:p1");
     $params = array();
     $this->assertTrue(QuerycacheTable1Query::create()->cacheContains('test2'), ' cache contains "test2" key');
     $this->assertEquals($expectedSql, $q->cacheFetch('test2'));
 }
Exemplo n.º 3
0
 protected function getPager($maxPerPage, $page = 1)
 {
     $query = QuerycacheTable1Query::create()->setQueryKey('query cache with paginate')->orderByTitle();
     $pager = new PropelModelPager($query, $maxPerPage);
     $pager->setPage($page);
     $pager->init();
     return $pager;
 }