Passed
Pull Request — master (#3)
by Simon
03:50 queued 48s
created

SolrTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

1 Method

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