1
|
|
|
<?php |
2
|
|
|
namespace Wonnova\SDK\Test\Model; |
3
|
|
|
|
4
|
|
|
use PHPUnit_Framework_TestCase as TestCase; |
5
|
|
|
use Wonnova\SDK\Model\Badge; |
6
|
|
|
|
7
|
|
|
class BadgeTest extends TestCase |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var Badge |
11
|
|
|
*/ |
12
|
|
|
private $badge; |
13
|
|
|
|
14
|
|
|
public function setUp() |
15
|
|
|
{ |
16
|
|
|
$this->badge = new Badge(); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function testName() |
20
|
|
|
{ |
21
|
|
|
$expected = 'The Badge'; |
22
|
|
|
$this->assertNull($this->badge->getName()); |
23
|
|
|
$this->assertSame($this->badge, $this->badge->setName($expected)); |
24
|
|
|
$this->assertEquals($expected, $this->badge->getName()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testDescription() |
28
|
|
|
{ |
29
|
|
|
$expected = 'This is a nice badge'; |
30
|
|
|
$this->assertNull($this->badge->getDescription()); |
31
|
|
|
$this->assertSame($this->badge, $this->badge->setDescription($expected)); |
32
|
|
|
$this->assertEquals($expected, $this->badge->getDescription()); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testImageUrl() |
36
|
|
|
{ |
37
|
|
|
$expected = 'https://secure.wonnova.com/rest/badges/34/image'; |
38
|
|
|
$this->assertNull($this->badge->getImageUrl()); |
39
|
|
|
$this->assertSame($this->badge, $this->badge->setImageUrl($expected)); |
40
|
|
|
$this->assertEquals($expected, $this->badge->getImageUrl()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testType() |
44
|
|
|
{ |
45
|
|
|
$expected = Badge::TYPE_COMBO; |
46
|
|
|
$this->assertNull($this->badge->getType()); |
47
|
|
|
$this->assertSame($this->badge, $this->badge->setType($expected)); |
48
|
|
|
$this->assertEquals($expected, $this->badge->getType()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function testNotificationDate() |
52
|
|
|
{ |
53
|
|
|
$expected = new \DateTime('2010-01-05 10:00:00'); |
54
|
|
|
$this->assertNull($this->badge->getNotificationDate()); |
55
|
|
|
$this->assertSame($this->badge, $this->badge->setNotificationDate($expected)); |
56
|
|
|
$this->assertSame($expected, $this->badge->getNotificationDate()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testToArray() |
60
|
|
|
{ |
61
|
|
|
$this->assertCount(0, $this->badge->toArray()); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|