Completed
Pull Request — master (#22)
by Maxime
02:45
created

LibraryTest::resourcesDirProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\VendorPlugin\Tests\Methods;
4
5
use PHPUnit\Framework\TestCase;
6
use SilverStripe\VendorPlugin\Library;
7
8
class LibraryTest extends TestCase
9
{
10
    /**
11
     * @dataProvider resourcesDirProvider
12
     */
13
    public function testResourcesDir($expected, $projectPath)
14
    {
15
        $path = __DIR__ . '/fixtures/projects/' . $projectPath;
16
        $lib = new Library($path, 'vendor/silverstripe/skynet');
17
        $this->assertEquals($expected, $lib->getResourcesDir());
18
    }
19
20
    public function resourcesDirProvider()
21
    {
22
        return [
23
            ['resources', 'ss43'],
24
            ['_resources', 'ss44'],
25
            ['customised-resources-dir', 'ss44WithCustomResourcesDir']
26
        ];
27
    }
28
29
    public function testInvalidResourceDir()
30
    {
31
        $this->expectException(\LogicException::class);
32
        $path = __DIR__ . '/fixtures/projects/ss44InvalidResourcesDir';
33
        $lib = new Library($path, 'vendor/silverstripe/skynet');
34
        $lib->getResourcesDir();
35
    }
36
}
37