Passed
Push — master ( 99a26c...eba7ab )
by Simon
02:10
created

SolrTest::testConfigureServer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 28
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace Firesphere\SolrCompatibility\Tests\Tests;
5
6
7
use Firesphere\SolrSearch\Services\SolrCoreService;
8
use SilverStripe\Dev\SapphireTest;
9
use SilverStripe\FullTextSearch\Solr\Solr;
10
11
class SolrTest extends SapphireTest
12
{
13
14
    public function testConfigureServer()
15
    {
16
        $config = [
17
            'host'       => 'localhost',
18
            'port'       => 1234,
19
            'indexstore' => [
20
                'mode' => 'post'
21
            ]
22
        ];
23
        Solr::configure_server($config);
24
25
        $expected = [
26
            'endpoint' =>
27
                [
28
                    'localhost' =>
29
                        [
30
                            'host' => 'localhost',
31
                            'port' => 1234,
32
                        ],
33
                ],
34
        ];
35
        $this->assertEquals($expected, SolrCoreService::config()->get('config'));
36
        $mode = [
37
            'mode' => 'post',
38
            'path' => '.solr'
39
        ];
40
        $this->assertEquals($mode, SolrCoreService::config()->get('mode'));
41
        $this->assertEquals(1, SolrCoreService::config()->get('cpucores'));
42
    }
43
}
44