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

SynonymsTest::testGetSynonymsAsString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
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
}