SolrTest::testConfigureServer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
c 0
b 0
f 0
dl 0
loc 28
rs 9.7
cc 1
nc 1
nop 0
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