Completed
Push — master ( 0136c1...94aca9 )
by Lukas Kahwe
03:29
created

NoCacheWebPathResolverTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 48
wmc 6
c 1
b 0
f 0
lcom 0
cbo 4
rs 10
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