forked from monicahq/monica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGiftTest.php
92 lines (71 loc) · 1.83 KB
/
GiftTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
namespace Tests\Unit;
use App\Gift;
use Carbon\Carbon;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class GiftTest extends TestCase
{
use DatabaseTransactions;
public function testGetNameReturnsNullIfUndefined()
{
$gift = new Gift;
$this->assertNull($gift->getName());
}
public function testGetNameReturnsName()
{
$gift = new Gift;
$gift->name = 'This is a test';
$this->assertEquals(
'This is a test',
$gift->getName()
);
}
public function testGetUrlReturnsNullIfUndefined()
{
$gift = new Gift;
$this->assertNull($gift->getUrl());
}
public function testGetURLReturnsURL()
{
$gift = new Gift;
$gift->url = 'https://test.com';
$this->assertEquals(
'https://test.com',
$gift->getUrl()
);
}
public function testGetCommentReturnsNullIfUndefined()
{
$gift = new Gift;
$this->assertNull($gift->getComment());
}
public function testGetCommentReturnsComment()
{
$gift = new Gift;
$gift->comment = 'this is a test';
$this->assertEquals(
'this is a test',
$gift->getComment()
);
}
public function testGetValueReturnsNullIfUndefined()
{
$gift = new Gift;
$this->assertNull($gift->getValue());
}
public function testGetValueReturnsValue()
{
$gift = new Gift;
$gift->value_in_dollars = '220.00';
$this->assertEquals(
'220.00',
$gift->getValue()
);
}
public function testGetCreatedAtReturnsCarbonObject()
{
$gift = factory(\App\Gift::class)->make();
$this->assertInstanceOf(Carbon::class, $gift->getCreatedAt());
}
}