Completed
Pull Request — master (#142)
by Robbie
10:23
created

AddonBuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetGitHubContext() 0 7 1
A repositoryContextProvider() 0 9 1
1
<?php
2
/**
3
 * Tests for the AddonBuilder
4
 */
5
class AddonBuilderTest extends SapphireTest
6
{
7
    /**
8
     * Test that a GitHub repository can be identified, and have its context returned if it matches
9
     *
10
     * @param string $input
11
     * @param string|false $expected
12
     * @dataProvider repositoryContextProvider
13
     */
14
    public function testGetGitHubContext($input, $expected)
15
    {
16
        $addon = new Addon(array('Repository' => $input));
17
        $builder = new AddonBuilder(new PackagistService);
18
        $result = $builder->getGitHubContext($addon);
19
        $this->assertSame($expected, $result);
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<AddonBuilderTest>.

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...
20
    }
21
22
    public function repositoryContextProvider()
23
    {
24
        return array(
25
            array('https://github.com/silverstripe/addons.org.git', 'silverstripe/addons.org'),
26
            array('http://github.com/silverstripe/addons.org.git', 'silverstripe/addons.org'),
27
            array('https://github.com/silverstripe/sspak.git', 'silverstripe/sspak'),
28
            array('http://github.com/silverstripe/sspak.git', 'silverstripe/sspak')
29
        );
30
    }
31
}
32