|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Liip\ImagineBundle\Tests\Imagine\Cache\Resolver; |
|
4
|
|
|
|
|
5
|
|
|
use Liip\ImagineBundle\Imagine\Cache\Resolver\NoCacheWebPathResolver; |
|
6
|
|
|
use Liip\ImagineBundle\Model\Binary; |
|
7
|
|
|
use Liip\ImagineBundle\Tests\AbstractTest; |
|
8
|
|
|
use Symfony\Component\Routing\RequestContext; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @covers Liip\ImagineBundle\Imagine\Cache\Resolver\NoCacheWebPathResolver |
|
12
|
|
|
*/ |
|
13
|
|
|
class NoCacheWebPathResolverTest extends AbstractTest |
|
14
|
|
|
{ |
|
15
|
|
|
public function testCouldBeConstructedWithRequestContextAsArgument() |
|
16
|
|
|
{ |
|
17
|
|
|
new NoCacheWebPathResolver(new RequestContext()); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function testComposeSchemaHostAndPathOnResolve() |
|
21
|
|
|
{ |
|
22
|
|
|
$context = new RequestContext('', 'GET', 'thehost', 'theSchema'); |
|
23
|
|
|
|
|
24
|
|
|
$resolver = new NoCacheWebPathResolver($context); |
|
25
|
|
|
|
|
26
|
|
|
$this->assertEquals('theschema://thehost/aPath', $resolver->resolve('aPath', 'aFilter')); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function testDoNothingOnStore() |
|
30
|
|
|
{ |
|
31
|
|
|
$resolver = new NoCacheWebPathResolver(new RequestContext()); |
|
32
|
|
|
|
|
33
|
|
|
$this->assertNull($resolver->store( |
|
34
|
|
|
new Binary('aContent', 'image/jpeg', 'jpg'), |
|
35
|
|
|
'a/path', |
|
36
|
|
|
'aFilter' |
|
37
|
|
|
)); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function testDoNothingForPathAndFilterOnRemove() |
|
41
|
|
|
{ |
|
42
|
|
|
$resolver = new NoCacheWebPathResolver(new RequestContext()); |
|
43
|
|
|
|
|
44
|
|
|
$resolver->remove(array('a/path'), array('aFilter')); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function testDoNothingForSomePathsAndSomeFiltersOnRemove() |
|
48
|
|
|
{ |
|
49
|
|
|
$resolver = new NoCacheWebPathResolver(new RequestContext()); |
|
50
|
|
|
|
|
51
|
|
|
$resolver->remove(array('foo', 'bar'), array('foo', 'bar')); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function testDoNothingForEmptyPathAndEmptyFilterOnRemove() |
|
55
|
|
|
{ |
|
56
|
|
|
$resolver = new NoCacheWebPathResolver(new RequestContext()); |
|
57
|
|
|
|
|
58
|
|
|
$resolver->remove(array(), array()); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|