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

TerminalTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGettersSetters() 0 22 1
A getTerminal() 0 4 1
A testUpdateSlug() 0 8 1
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
}