Passed
Push — master ( 77ea2f...859eb4 )
by Simon
01:40
created

SynonymsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetSynonymsAsString() 0 10 1
A testGetSynonyms() 0 5 1
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Tests;
5
6
7
use Firesphere\SolrSearch\Helpers\Synonyms;
8
use SilverStripe\Dev\SapphireTest;
9
10
class SynonymsTest extends SapphireTest
11
{
12
13
    public function testGetSynonyms()
14
    {
15
        $synonyms = Synonyms::config()->get('synonyms');
16
17
        $this->assertEquals($synonyms, Synonyms::getSynonyms());
18
    }
19
20
    public function testGetSynonymsAsString()
21
    {
22
        $synonyms = Synonyms::config()->get('synonyms');
23
24
        $rendered = Synonyms::getSynonymsAsString();
25
26
        $this->assertStringEndsWith("\n", $rendered);
27
28
        // Add 1 to the count, because the rendered string ends with a newline, thus adding one item to the array
29
        $this->assertCount(count($synonyms) + 1, explode("\n", $rendered));
30
    }
31
}