Security update for permissions_by_term
[yaffs-website] / vendor / behat / gherkin / tests / Behat / Gherkin / Cache / MemoryCacheTest.php
1 <?php
2
3 namespace Tests\Behat\Gherkin\Cache;
4
5 use Behat\Gherkin\Cache\MemoryCache;
6 use Behat\Gherkin\Node\FeatureNode;
7 use Behat\Gherkin\Node\ScenarioNode;
8
9 class MemoryCacheTest extends \PHPUnit_Framework_TestCase
10 {
11     private $cache;
12
13     public function testIsFreshWhenThereIsNoFile()
14     {
15         $this->assertFalse($this->cache->isFresh('unexisting', time() + 100));
16     }
17
18     public function testIsFreshOnFreshFile()
19     {
20         $feature = new FeatureNode(null, null, array(), null, array(), null, null, null, null);
21
22         $this->cache->write('some_path', $feature);
23
24         $this->assertFalse($this->cache->isFresh('some_path', time() + 100));
25     }
26
27     public function testIsFreshOnOutdated()
28     {
29         $feature = new FeatureNode(null, null, array(), null, array(), null, null, null, null);
30
31         $this->cache->write('some_path', $feature);
32
33         $this->assertTrue($this->cache->isFresh('some_path', time() - 100));
34     }
35
36     public function testCacheAndRead()
37     {
38         $scenarios = array(new ScenarioNode('Some scenario', array(), array(), null, null));
39         $feature = new FeatureNode('Some feature', 'some description', array(), null, $scenarios, null, null, null, null);
40
41         $this->cache->write('some_feature', $feature);
42         $featureRead = $this->cache->read('some_feature');
43
44         $this->assertEquals($feature, $featureRead);
45     }
46
47     protected function setUp()
48     {
49         $this->cache = new MemoryCache();
50     }
51 }