1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the MilioooMessageBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Michiel boeckaert <[email protected]> |
7
|
|
|
* This source file is subject to the MIT license that is bundled |
8
|
|
|
* with this source code in the file LICENSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Miliooo\Messaging\Tests\Form\FormModel; |
12
|
|
|
|
13
|
|
|
use Miliooo\Messaging\Form\FormModel\AbstractNewMessage; |
14
|
|
|
use Miliooo\Messaging\TestHelpers\ParticipantTestHelper; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Test file for Miliooo\Messaging\Form\FormModel\AbstractNewMessage |
18
|
|
|
* |
19
|
|
|
* @author Michiel Boeckaert <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class AbstractNewMessageTest extends \PHPUnit_Framework_TestCase |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* The class under test |
25
|
|
|
* @var AbstractNewMessage |
26
|
|
|
*/ |
27
|
|
|
private $formModel; |
28
|
|
|
|
29
|
|
|
public function setUp() |
30
|
|
|
{ |
31
|
|
|
$this->formModel = $this->getMockForAbstractClass('Miliooo\Messaging\Form\FormModel\AbstractNewMessage'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function testInterface() |
35
|
|
|
{ |
36
|
|
|
$this->assertInstanceOf('Miliooo\Messaging\Form\FormModel\NewMessageInterface', $this->formModel); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function testBodyWorks() |
40
|
|
|
{ |
41
|
|
|
$body = "the body"; |
42
|
|
|
$this->formModel->setBody($body); |
43
|
|
|
$this->assertSame($body, $this->formModel->getBody()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testCreatedAtWorks() |
47
|
|
|
{ |
48
|
|
|
$createdAt = new \DateTime('now'); |
49
|
|
|
$this->formModel->setCreatedAt($createdAt); |
50
|
|
|
$this->assertSame($createdAt, $this->formModel->getCreatedAt()); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function testSenderWorks() |
54
|
|
|
{ |
55
|
|
|
$sender = new ParticipantTestHelper(1); |
56
|
|
|
$this->formModel->setSender($sender); |
57
|
|
|
$this->assertSame($sender, $this->formModel->getSender()); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|