CommentTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSettersGetters() 0 24 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\NewsBundle\Tests\Model;
15
16
use PHPUnit\Framework\TestCase;
17
use Sonata\NewsBundle\Model\Comment;
18
use Sonata\NewsBundle\Model\PostInterface;
19
20
class ModelTest_Comment extends Comment
21
{
22
    public function getId(): void
23
    {
24
    }
25
}
26
27
class CommentTest extends TestCase
28
{
29
    public function testSettersGetters(): void
30
    {
31
        $date = new \DateTime();
32
33
        $comment = new ModelTest_Comment();
34
        $comment->setCreatedAt($date);
35
        $comment->setEmail('[email protected]');
36
        $comment->setMessage('My message');
37
        $comment->setName('My name');
38
        $comment->setPost($post = $this->createMock(PostInterface::class));
39
        $comment->setStatus(1);
40
        $comment->setUpdatedAt($date);
41
        $comment->setUrl('http://www.example.org');
42
43
        $this->assertSame($date, $comment->getCreatedAt());
44
        $this->assertSame('[email protected]', $comment->getEmail());
45
        $this->assertSame('My message', $comment->getMessage());
46
        $this->assertSame('My name', $comment->getName());
47
        $this->assertInstanceOf(PostInterface::class, $post);
48
        $this->assertSame($post, $comment->getPost());
49
        $this->assertSame(1, $comment->getStatus());
50
        $this->assertSame($date, $comment->getUpdatedAt());
51
        $this->assertSame('http://www.example.org', $comment->getUrl());
52
    }
53
}
54