|
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
|
|
|
} |