Completed
Push — features/addons-api ( a15d66 )
by Sam
10:47
created

AddonToArrayTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 38
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testAddonToJson() 0 26 1
1
<?php
2
3
4
use SilverStripe\Elastica\Searchable;
5
6
/**
7
 * Tests for AddonToArray
8
 *
9
 * @mixin PHPUnit_Framework_TestCase
10
 */
11
class AddonToArrayTest extends SapphireTest
12
{
13
14
    protected static $fixture_file = 'mysite/tests/services/testAddon.yml';
15
16
    protected $illegalExtensions = [
17
        'Addon' => [
18
            Searchable::class,
19
        ]
20
    ];
21
22
    public function testAddonToJson()
23
    {
24
        $addonToArray = new AddonToArray();
25
        /** @var Addon $addon */
26
        $addon = $this->objFromFixture('Addon', 'addon_a');
27
        $result = $addonToArray->convert($addon);
28
29
30
        $this->assertEquals('sminnee/test-package', $result['Name']);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
        $this->assertInstanceof('Datetime', $result['Released']);
0 ignored issues
show
Bug introduced by
The method assertInstanceof() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        $this->assertEquals([ 'Name' => 'good_code_coverage', 'Value' => 0 ], $result['RatingDetails'][0]);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
        $this->assertEquals(2, sizeof($result['Versions']));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
        $this->assertEquals('1.4.2.0', $result['Versions'][0]['Version']);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
        $this->assertEquals(
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            [[ 'Version' => '3.6', 'Major' => 3, 'Minor' => 6 ]],
37
            $result['Versions'][0]['CompatibleVersions']
38
        );
39
        $this->assertEquals(
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<AddonToArrayTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
            [[
41
                'Name' => 'Uncle Cheese',
42
                'Email' => '[email protected]',
43
                'Homepage' => 'http://leftandmain.com',
44
            ]],
45
            $result['Versions'][0]['Authors']
46
        );
47
    }
48
}
49