Example #1
0
 /**
  * @test
  */
 public function shouldDeleteCacheWhenRecordIsUpdated()
 {
     // given
     $capital = new Capital(2);
     $this->triggerJSONFor('Capital', 2);
     $capital->asJSON();
     // Trigger JSON caching
     $capital->setName('Stavanger');
     $capital->commit();
     // when
     $json = new LudoDBCache($capital, array(2));
     // then
     $this->assertFalse($json->hasData());
 }
Example #2
0
 /**
  * @test
  */
 public function shouldBeAbleToStoreJSONInJSONCache()
 {
     // given
     $this->createCapitalCollection();
     $capitals = new Capitals(5000, 6000);
     $this->assertEquals(4, count($capitals->getValues()));
     $this->triggerJSONFor('Capitals', array(5000, 6000));
     // when
     $cache = new LudoDBCache($capitals, array(5000, 6000));
     // then
     $val = $this->getDb()->getValue("select count(ID) from ludo_db_cache where class_name='Capitals'");
     $this->assertEquals(1, $val);
     $this->assertTrue($cache->hasData());
 }