/** * @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()); }
/** * @test */ public function shouldDeleteCacheOfParentsWhenUpdated() { // given $this->createCapitalCollection(); $capitals = new Capitals(5000, 6000); $capitals->asJSON(); // Trigger caching // when $capital = new Capital(101); $capital->setName('Stavanger'); $capital->commit(); $capitals = new Capitals(5000, 6000); $json = new LudoDBCache($capitals, array(5000, 6000)); $this->log($json->getCache()); // then $this->assertFalse($json->hasData()); }