These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Tests\Entity; |
||
4 | |||
5 | use DateTime; |
||
6 | use Doctrine\Common\Collections\ArrayCollection; |
||
7 | use Kunstmaan\FormBundle\Entity\FormSubmission; |
||
8 | use Kunstmaan\NodeBundle\Entity\Node; |
||
9 | use PHPUnit\Framework\TestCase; |
||
10 | |||
11 | class FormSubmissionTest extends TestCase |
||
12 | { |
||
13 | /** |
||
14 | * @var FormSubmission |
||
15 | */ |
||
16 | protected $object; |
||
17 | |||
18 | /** |
||
19 | * Sets up the fixture, for example, opens a network connection. |
||
20 | * This method is called before a test is executed. |
||
21 | */ |
||
22 | protected function setUp() |
||
23 | { |
||
24 | $this->object = new FormSubmission(); |
||
25 | } |
||
26 | |||
27 | public function testSetGetId() |
||
28 | { |
||
29 | $object = $this->object; |
||
30 | $id = 123; |
||
31 | $object->setId($id); |
||
32 | $this->assertEquals($id, $object->getId()); |
||
33 | } |
||
34 | |||
35 | public function testSetGetIpAddress() |
||
36 | { |
||
37 | $object = $this->object; |
||
38 | $ip = '127.0.0.1'; |
||
39 | $object->setIpAddress($ip); |
||
40 | $this->assertEquals($ip, $object->getIpAddress()); |
||
41 | } |
||
42 | |||
43 | public function testSetGetNode() |
||
44 | { |
||
45 | $object = $this->object; |
||
46 | $node = new Node(); |
||
47 | $node->setId(123); |
||
48 | $object->setNode($node); |
||
49 | $retrievedNode = $object->getNode(); |
||
50 | $this->assertEquals($node, $retrievedNode); |
||
51 | $this->assertEquals($node->getId(), $retrievedNode->getId()); |
||
52 | } |
||
53 | |||
54 | public function testSetGetLang() |
||
55 | { |
||
56 | $object = $this->object; |
||
57 | $lang = 'nl'; |
||
58 | $object->setLang($lang); |
||
59 | $this->assertEquals($lang, $object->getLang()); |
||
60 | } |
||
61 | |||
62 | public function testSetGetCreated() |
||
63 | { |
||
64 | $object = $this->object; |
||
65 | $now = new DateTime(); |
||
66 | $object->setCreated($now); |
||
67 | $this->assertEquals($now, $object->getCreated()); |
||
68 | } |
||
69 | |||
70 | public function testGetFields() |
||
71 | { |
||
72 | $object = $this->object; |
||
73 | $this->assertInstanceOf(ArrayCollection::class, $object->getFields()); |
||
74 | } |
||
75 | |||
76 | public function testToString() |
||
77 | { |
||
78 | $stringValue = $this->object->__toString(); |
||
79 | $this->assertNotNull($stringValue); |
||
80 | $this->assertInternalType('string', $stringValue); |
||
0 ignored issues
–
show
|
|||
81 | } |
||
82 | } |
||
83 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.