GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ImgUrlTest::testGetNewImageNotFromCache()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 32
nc 1
nop 0
1
<?php
2
namespace HtImgModuleTest\View\Helper;
3
4
use HtImgModule\View\Helper\ImgUrl;
5
6
class ImgUrlTest extends \PHPUnit_Framework_TestCase
7
{
8
    public function testGetNewImageNotFromCache()
9
    {
10
        $cacheManager =  $this->createMock('HtImgModule\Service\CacheManagerInterface');
11
        $binary = $this->createMock('HtImgModule\Binary\BinaryInterface');
12
        $loaderManager = $this->createMock('HtImgModule\Imagine\Loader\LoaderManagerInterface');
13
        $loaderManager->expects($this->once())
14
            ->method('loadBinary')
15
            ->with('path/to/some/random/image/', 'foo_view_filter')
16
            ->will($this->returnValue($binary));
17
        $filterManager = $this->createMock('HtImgModule\Imagine\Filter\FilterManagerInterface');
18
        $filterManager->expects($this->once())
19
            ->method('getFilterOptions')
20
            ->with('foo_view_filter')
21
            ->will($this->returnValue([]));
22
        $cacheManager->expects($this->once())
23
            ->method('isCachingEnabled')
24
            ->with('foo_view_filter', [])
25
            ->will($this->returnValue(false));
26
        $helper = new ImgUrl(
27
            $cacheManager,
28
            $filterManager,
29
            $loaderManager
30
        );
31
        $urlHelper = $this->createMock('Zend\View\Helper\Url');
32
        $renderer = $this->createMock('Zend\View\Renderer\PhpRenderer');
33
        $renderer->expects($this->once())
34
            ->method('plugin')
35
            ->with('url')
36
            ->will($this->returnValue($urlHelper));
37
        $urlHelper->expects($this->once())
38
            ->method('__invoke')
39
            ->will($this->returnValue('url/to/some/random/image'));
40
        $helper->setView($renderer);
41
        $this->assertEquals('url/to/some/random/image', $helper('path/to/some/random/image/', 'foo_view_filter'));
42
    }
43
44
    public function testGetImageFromCache()
45
    {
46
        $cacheManager =  $this->createMock('HtImgModule\Service\CacheManagerInterface');
47
        $cacheManager->expects($this->once())
48
            ->method('cacheExists')
49
            ->with('path/to/some/random/image/', 'foo_view_filter', 'jpeg')
50
            ->will($this->returnValue(true));
51
        $cacheManager->expects($this->once())
52
            ->method('getCacheUrl')
53
            ->with('path/to/some/random/image/', 'foo_view_filter', 'jpeg')
54
            ->will($this->returnValue('flowers.jpg'));
55
        $loaderManager = $this->createMock('HtImgModule\Imagine\Loader\LoaderManagerInterface');
56
        $filterManager = $this->createMock('HtImgModule\Imagine\Filter\FilterManagerInterface');
57
        $filterOptions = ['format' => 'jpeg'];
58
        $filterManager->expects($this->once())
59
            ->method('getFilterOptions')
60
            ->with('foo_view_filter')
61
            ->will($this->returnValue($filterOptions));
62
        $cacheManager->expects($this->once())
63
            ->method('isCachingEnabled')
64
            ->with('foo_view_filter', $filterOptions)
65
            ->will($this->returnValue(true));
66
        $helper = new ImgUrl(
67
            $cacheManager,
68
            $filterManager,
69
            $loaderManager
70
        );
71
        $renderer = $this->createMock('Zend\View\Renderer\PhpRenderer');
72
        $renderer->expects($this->once())
73
            ->method('plugin')
74
            ->with('basePath')
75
            ->will($this->returnValue(function () {return '/app';}));
76
        $helper->setView($renderer);
77
        $this->assertEquals('/app/flowers.jpg', $helper('path/to/some/random/image/', 'foo_view_filter'));
78
    }
79
}
80