Completed
Push — master ( 0d9cfe...073f2f )
by Joachim
12:30
created

TerminalTest::testUpdateCanonical()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
namespace Tests\Loevgaard\DandomainAltapayBundle\Entity;
3
4
use Loevgaard\DandomainAltapayBundle\Entity\Terminal;
5
use PHPUnit\Framework\TestCase;
6
7
class TerminalTest extends TestCase
8
{
9
    public function testGettersSetters()
10
    {
11
        $terminal = $this->getTerminal();
12
13
        $this->assertNull($terminal->getTitle());
14
        $this->assertNull($terminal->getSlug());
15
        $this->assertNull($terminal->getCountry());
16
        $this->assertNull($terminal->getCurrencies());
17
        $this->assertNull($terminal->getNatures());
18
19
        $terminal
20
            ->setTitle('title')
21
            ->setCountry('DK')
22
            ->setCurrencies(['EUR', 'DKK'])
23
            ->setNatures(['Nature 1', 'Nature 2'])
24
        ;
25
26
        $this->assertSame('title', $terminal->getTitle());
27
        $this->assertSame('DK', $terminal->getCountry());
28
        $this->assertSame(['EUR', 'DKK'], $terminal->getCurrencies());
29
        $this->assertSame(['Nature 1', 'Nature 2'], $terminal->getNatures());
30
    }
31
32
    public function testUpdateSlug()
33
    {
34
        $terminal = $this->getTerminal();
35
        $terminal->setTitle('test title !"#(€ EUR');
36
        $terminal->updateSlug();
37
38
        $this->assertEquals('test-title-eur', $terminal->getSlug());
39
    }
40
41
    /**
42
     * @return Terminal
43
     */
44
    public function getTerminal()
45
    {
46
        return $this->getMockForAbstractClass(Terminal::class);
47
    }
48
}