X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FCache%2FMemoryCacheTest.php;fp=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FCache%2FMemoryCacheTest.php;h=a0bb6c86fc0d945e5970179dd4e799e52afd1ccf;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hp=0000000000000000000000000000000000000000;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68;p=yaffs-website diff --git a/vendor/behat/gherkin/tests/Behat/Gherkin/Cache/MemoryCacheTest.php b/vendor/behat/gherkin/tests/Behat/Gherkin/Cache/MemoryCacheTest.php new file mode 100644 index 000000000..a0bb6c86f --- /dev/null +++ b/vendor/behat/gherkin/tests/Behat/Gherkin/Cache/MemoryCacheTest.php @@ -0,0 +1,51 @@ +assertFalse($this->cache->isFresh('unexisting', time() + 100)); + } + + public function testIsFreshOnFreshFile() + { + $feature = new FeatureNode(null, null, array(), null, array(), null, null, null, null); + + $this->cache->write('some_path', $feature); + + $this->assertFalse($this->cache->isFresh('some_path', time() + 100)); + } + + public function testIsFreshOnOutdated() + { + $feature = new FeatureNode(null, null, array(), null, array(), null, null, null, null); + + $this->cache->write('some_path', $feature); + + $this->assertTrue($this->cache->isFresh('some_path', time() - 100)); + } + + public function testCacheAndRead() + { + $scenarios = array(new ScenarioNode('Some scenario', array(), array(), null, null)); + $feature = new FeatureNode('Some feature', 'some description', array(), null, $scenarios, null, null, null, null); + + $this->cache->write('some_feature', $feature); + $featureRead = $this->cache->read('some_feature'); + + $this->assertEquals($feature, $featureRead); + } + + protected function setUp() + { + $this->cache = new MemoryCache(); + } +}