NewThreadSingleRecipientTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 56
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetRecipientWorks() 0 5 1
A testGetRecipientsReturnsArayWhenEmpty() 0 4 1
A setUp() 0 5 1
A testInterface() 0 4 1
A testRecipientWorks() 0 6 1
A testSubjectWorks() 0 6 1
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\NewThreadSingleRecipient;
14
use Miliooo\Messaging\TestHelpers\ParticipantTestHelper;
15
use Miliooo\Messaging\User\ParticipantInterface;
16
17
/**
18
 * Test file for Miliooo\Messaging\Form\FormModel\NewThreadSingleRecipient
19
 *
20
 * @author Michiel Boeckaert <[email protected]>
21
 */
22
class NewThreadSingleRecipientTest extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * The class under test.
26
     *
27
     * @var NewThreadSingleRecipient
28
     */
29
    private $formModel;
30
31
    /**
32
     * A participant
33
     *
34
     * @var ParticipantInterface
35
     */
36
    private $recipient;
37
38
39
    public function setUp()
40
    {
41
        $this->formModel = new NewThreadSingleRecipient();
42
        $this->recipient = new ParticipantTestHelper(1);
43
    }
44
45
    public function testInterface()
46
    {
47
        $this->assertInstanceOf('Miliooo\Messaging\Form\FormModel\NewThreadInterface', $this->formModel);
48
    }
49
50
    public function testRecipientWorks()
51
    {
52
        $recipient = new ParticipantTestHelper(1);
53
        $this->formModel->setRecipient($recipient);
54
        $this->assertSame([$recipient], $this->formModel->getRecipients());
55
    }
56
57
    public function testSubjectWorks()
58
    {
59
        $subject = 'this is the subject';
60
        $this->formModel->setSubject($subject);
61
        $this->assertSame($subject, $this->formModel->getSubject());
62
    }
63
64
    /**
65
     * The form will call this function to get the recipient.
66
     */
67
    public function testGetRecipientWorks()
68
    {
69
        $this->formModel->setRecipient($this->recipient);
70
        $this->assertSame($this->recipient, $this->formModel->getRecipient());
71
    }
72
73
    public function testGetRecipientsReturnsArayWhenEmpty()
74
    {
75
        $this->assertEquals([], $this->formModel->getRecipients());
76
    }
77
}
78