PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / kriswallsmith / assetic / tests / Assetic / Test / Cache / ConfigCacheTest.php

ConfigCacheTest.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/kriswallsmith/assetic/tests/Assetic/Test/Cache/ConfigCacheTest.php

69 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2014 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Assetic\Test\Cache;
13
14 use Assetic\Cache\ConfigCache;
15 use Assetic\Test\TestCase;
16
17 class ConfigCacheTest extends TestCase
18 {
19 private $dir;
20 private $cache;
21
22 protected function setUp()
23 {
24 $this->dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('assetic_config_cache');
25 mkdir($this->dir);
26
27 $this->cache = new ConfigCache($this->dir);
28 }
29
30 protected function tearDown()
31 {
32 self::removeDirectory($this->dir);
33 $this->dir = null;
34 $this->cache = null;
35 }
36
37 public function testCache()
38 {
39 $this->cache->set('foo', array(1, 2, 3));
40 $this->assertEquals(array(1, 2, 3), $this->cache->get('foo'), '->get() returns the ->set() value');
41 }
42
43 public function testTimestamp()
44 {
45 $this->cache->set('bar', array(4, 5, 6));
46 $this->assertInternalType('integer', $time = $this->cache->getTimestamp('bar'), '->getTimestamp() returns an integer');
47 $this->assertNotEmpty($time, '->getTimestamp() returns a non-empty number');
48 }
49
50 public function testInvalidValue()
51 {
52 $this->setExpectedException('RuntimeException');
53 $this->cache->get('_invalid');
54 }
55
56 public function testInvalidTimestamp()
57 {
58 $this->setExpectedException('RuntimeException');
59 $this->cache->getTimestamp('_invalid');
60 }
61
62 public function testHas()
63 {
64 $this->cache->set('foo', 'bar');
65 $this->assertTrue($this->cache->has('foo'));
66 $this->assertFalse($this->cache->has('_invalid'));
67 }
68 }
69