Passed
Push — hans/code-cleanup ( ca2456...0eaecc )
by Simon
05:29
created

SynonymsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 2
eloc 9
c 2
b 2
f 0
dl 0
loc 20
rs 10
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Tests;
5
6
use Firesphere\SolrSearch\Helpers\Synonyms;
7
use SilverStripe\Dev\SapphireTest;
8
9
class SynonymsTest extends SapphireTest
10
{
11
    public function testGetSynonyms()
12
    {
13
        $synonyms = Synonyms::config()->get('usuk');
14
15
        $this->assertEquals($synonyms['synonyms'], Synonyms::getSynonyms());
16
        $this->assertEmpty(Synonyms::getSynonyms(false));
17
    }
18
19
    public function testGetSynonymsAsString()
20
    {
21
        $synonyms = Synonyms::config()->get('usuk');
22
        $synonyms = $synonyms['synonyms'];
23
        $rendered = Synonyms::getSynonymsAsString();
24
25
        $this->assertStringEndsWith("\n", $rendered);
26
27
        // Add 1 to the count, because the rendered string ends with a newline, thus adding one item to the array
28
        $this->assertCount(count($synonyms) + 1, explode("\n", $rendered));
29
    }
30
}
31