|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace JhFlexiTimeTest\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use JhFlexiTime\DateTime\DateTime; |
|
6
|
|
|
use JhFlexiTime\Entity\BookedCredit; |
|
7
|
|
|
use JhFlexiTime\Entity\BookedCreditType; |
|
8
|
|
|
use JhUser\Entity\User; |
|
9
|
|
|
use PHPUnit_Framework_TestCase; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class BookedCreditTest |
|
13
|
|
|
* @package JhFlexiTimeTest\Entity |
|
14
|
|
|
* @author Aydin Hassan <[email protected]> |
|
15
|
|
|
*/ |
|
16
|
|
|
class BookedCreditTest extends PHPUnit_Framework_TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var BookedCredit |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $entity; |
|
22
|
|
|
|
|
23
|
|
|
public function setUp() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->entity = new BookedCredit; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testGetterSetters() |
|
29
|
|
|
{ |
|
30
|
|
|
$this->assertNull($this->entity->getId()); |
|
31
|
|
|
$this->assertNull($this->entity->getUser()); |
|
32
|
|
|
$this->assertNull($this->entity->getDate()); |
|
33
|
|
|
$this->assertNull($this->entity->getAmount()); |
|
34
|
|
|
$this->assertNull($this->entity->getType()); |
|
35
|
|
|
$this->assertNull($this->entity->getNotes()); |
|
36
|
|
|
|
|
37
|
|
|
$user = new User; |
|
38
|
|
|
$date = new DateTime; |
|
39
|
|
|
$type = new BookedCreditType; |
|
40
|
|
|
|
|
41
|
|
|
$this->entity->setId(2); |
|
42
|
|
|
$this->entity->setUser($user); |
|
43
|
|
|
$this->entity->setDate($date); |
|
44
|
|
|
$this->entity->setAmount(7.5); |
|
45
|
|
|
$this->entity->setType($type); |
|
46
|
|
|
$this->entity->setNotes('notes'); |
|
47
|
|
|
|
|
48
|
|
|
$this->assertSame(2, $this->entity->getId()); |
|
49
|
|
|
$this->assertSame($user, $this->entity->getUser()); |
|
50
|
|
|
$this->assertSame($date, $this->entity->getDate()); |
|
51
|
|
|
$this->assertSame(7.5, $this->entity->getAmount()); |
|
52
|
|
|
$this->assertSame($type, $this->entity->getType()); |
|
53
|
|
|
$this->assertSame('notes', $this->entity->getNotes()); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|