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.
Completed
Pull Request — master (#34)
by
unknown
04:00 queued 02:11
created

FlysystemLoaderTest::testLoadBinary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
namespace HtImgModuleTest\Imagine\Loader;
3
4
use HtImgModule\Imagine\Loader\FlysystemLoader;
5
use League\Flysystem\FileNotFoundException;
6
7
class FlysystemLoaderTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testGetExceptionWhenImageFileCouldNotBeFound()
10
    {
11
        $filesystem = $this->createMock('League\Flysystem\FilesystemInterface');
12
        $filesystem->expects($this->exactly(1))
13
            ->method('read')
14
            ->with('my/special/image')
15
            ->will($this->throwException(new FileNotFoundException('my/special/image')));
16
        $loader = new FlysystemLoader($filesystem);
17
18
        $this->setExpectedException('HtImgModule\Exception\ImageNotFoundException');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
19
        $loader->load('my/special/image');
20
    }
21
22
    public function testLoadBinary()
23
    {
24
        $filesystem = $this->createMock('League\Flysystem\FilesystemInterface');
25
        $filesystem->expects($this->exactly(1))
26
            ->method('read')
27
            ->with('my/special/image')
28
            ->will($this->returnValue('some/image/content'));
29
        $filesystem->expects($this->exactly(1))
30
            ->method('getMimeType')
31
            ->with('my/special/image')
32
            ->will($this->returnValue('image/png'));
33
        $loader = new FlysystemLoader($filesystem);
34
        $binary = $loader->load('my/special/image');
35
        $this->assertInstanceOf('HtImgModule\Binary\Binary', $binary);
36
        $this->assertEquals('some/image/content', $binary->getContent());
37
        $this->assertEquals('image/png', $binary->getMimeType());
38
    }
39
40
    public function testLoadOnlyContentsWhenMimeTypeCouldNotDetected()
41
    {
42
        $filesystem = $this->createMock('League\Flysystem\FilesystemInterface');
43
        $filesystem->expects($this->exactly(1))
44
            ->method('read')
45
            ->with('my/special/image')
46
            ->will($this->returnValue('some/image/content'));
47
        $filesystem->expects($this->exactly(1))
48
            ->method('getMimeType')
49
            ->with('my/special/image')
50
            ->will($this->returnValue(false));
51
        $loader = new FlysystemLoader($filesystem);
52
        $this->assertEquals('some/image/content', $loader->load('my/special/image'));
53
    }
54
}
55