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

SolrTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 18
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConfigureServer() 0 28 1
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