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.

ModuleOptionsTest::testSettersAndGetters()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 27
rs 8.8571
c 2
b 0
f 0
cc 1
eloc 24
nc 1
nop 0
1
<?php
2
3
namespace HtImgModuleTest\Options;
4
5
use HtImgModule\Options\ModuleOptions;
6
7
class ModuleOptionsTest extends \PHPUnit_Framework_TestCase
8
{
9
10
    public function testSettersAndGetters()
11
    {
12
        $moduleOptions = new ModuleOptions([
13
            'enable_cache' => false,
14
            'img_source_path_stack' => ['img/'],
15
            'img_source_map' => ['name' => 'hello'],
16
            'driver' => 'imagick',
17
            'filters' => ['hello'],
18
            'web_root' => 'web',
19
            'image_resolvers' => ['image_resolvers'],
20
            'cache_path' => 'images',
21
            'cache_expiry' => 678678,
22
            'filter_loaders' => ['factories' => [], 'aliases' => []],
23
            'default_image_loader' => 'my_image_loader',
24
        ]);
25
        $this->assertEquals(false, $moduleOptions->getEnableCache());
26
        $this->assertEquals(['img/'], $moduleOptions->getImgSourcePathStack());
27
        $this->assertEquals(['name' => 'hello'], $moduleOptions->getImgSourceMap());
28
        $this->assertEquals('imagick', $moduleOptions->getDriver());
29
        $this->assertEquals(['hello'], $moduleOptions->getFilters());
30
        $this->assertEquals('web', $moduleOptions->getWebRoot());
31
        $this->assertEquals(['image_resolvers'], $moduleOptions->getImageResolvers());
32
        $this->assertEquals('images', $moduleOptions->getCachePath());
33
        $this->assertEquals(678678, $moduleOptions->getCacheExpiry());
34
        $this->assertEquals(['factories' => [], 'aliases' => []], $moduleOptions->getFilterLoaders());
35
        $this->assertEquals('my_image_loader', $moduleOptions->getDefaultImageLoader());
36
    }
37
38
    public function testGetExceptionWithInvalidDriver()
39
    {
40
        $this->setExpectedException('HtImgModule\Exception\InvalidArgumentException');
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...
41
        $moduleOptions = new ModuleOptions(['driver' => 'iasfdasdf',]);
0 ignored issues
show
Unused Code introduced by
$moduleOptions is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
42
    }
43
44
    public function testAddFilter()
45
    {
46
        $moduleOptions = new ModuleOptions;
47
        $moduleOptions->addFilter('foo_and_crop', ['foo' => 'crop']);
48
        $this->assertCount(1, $moduleOptions->getFilters());
49
        $this->assertEquals(['foo' => 'crop'], $moduleOptions->getFilters()['foo_and_crop']);
50
    }
51
}
52