Passed
Push — sheepy/introspection ( 9a33c8...7d1300 )
by Marco
05:54
created

ConfigStoreTest::testPostConstructNoPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 1
b 1
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Tests;
5
6
use Firesphere\SolrSearch\Stores\FileConfigStore;
7
use Firesphere\SolrSearch\Stores\PostConfigStore;
8
use SilverStripe\Control\Director;
9
use SilverStripe\Dev\SapphireTest;
10
11
class ConfigStoreTest extends SapphireTest
12
{
13
14
    /**
15
     * @expectedException \Solarium\Exception\RuntimeException
16
     */
17
    public function testFileConstruct()
18
    {
19
        new FileConfigStore([]);
20
    }
21
22
    public function testFileConstructGood()
23
    {
24
        $store = new FileConfigStore(['path' => 'test']);
25
        $this->assertEquals(Director::baseFolder() . '/test/lol', $store->instanceDir('lol'));
26
27
        $this->assertEquals(['path' => Director::baseFolder() . '/test'], $store->getConfig());
28
    }
29
30
    /**
31
     * @expectedException \Solarium\Exception\RuntimeException
32
     */
33
    public function testPostConstruct()
34
    {
35
        new PostConfigStore([]);
36
    }
37
38
    public function testPostConstructGood()
39
    {
40
        $store = new PostConfigStore(['path' => 'test']);
41
42
        $this->assertEquals('test/', $store->getPath());
43
44
        $this->assertEquals('lol', $store->instanceDir('lol'));
45
    }
46
47
    public function testPostConstructNoPath()
48
    {
49
        $store = new PostConfigStore(['test' => 'this']);
50
51
        $this->assertEquals('/', $store->getPath());
52
    }
53
}
54