Passed
Push — master ( d685f8...514c5e )
by Simon
06:45
created

SolrTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

1 Method

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