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

AddonBuilderTest::repositoryContextProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
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