Completed
Pull Request — master (#1)
by Davis
01:51
created

TestPost   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 5 1
A postConstructor() 0 9 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: davis
5
 * Date: 7/23/17
6
 * Time: 7:25 PM
7
 */
8
9
namespace DavisPeixoto\BlogCore\Tests\Entity;
10
11
use DateTime;
12
use DavisPeixoto\BlogCore\Entity\Post;
13
use DavisPeixoto\BlogCore\Entity\Author;
14
use DavisPeixoto\BlogCore\Entity\Tag;
15
use PHPUnit_Framework_TestCase;
16
use Ramsey\Uuid\Uuid;
17
18
class TestPost extends PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @param $uuid
22
     * @param $title
23
     * @param $body
24
     * @param $author
25
     * @param $tags
26
     * @param $publishDate
27
     * @param $expected
28
     * @param $message
29
     * @dataProvider postConstructor
30
     */
31
    public function testConstructor($uuid, $title, $body, $author, $tags, $publishDate, $expected, $message)
32
    {
33
        $post = new Post($uuid, $title, $body, $author, $tags, $publishDate);
34
        $this->assertInstanceOf($expected, $post, $message);
35
    }
36
37
    public function postConstructor()
38
    {
39
        return [
40
            [Uuid::uuid4(), 'A Post', 'Lorem ipsum', new Author(Uuid::uuid4(), 'Davis', '[email protected]', 'Some string', new DateTime()), [], null, Post::class, 'no tags, no publish date'],
41
            [Uuid::uuid4(), 'A Post', 'Lorem ipsum', new Author(Uuid::uuid4(), 'Davis', '[email protected]', 'Some string', new DateTime()), [new Tag(Uuid::uuid4(),'tag1'), new Tag(Uuid::uuid4(),'tag2')], null, Post::class, 'have tags, unpublished'],
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 200 characters; contains 250 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
42
            [Uuid::uuid4(), 'A Post', 'Lorem ipsum', new Author(Uuid::uuid4(), 'Davis', '[email protected]', 'Some string', new DateTime()), [], new DateTime(), Post::class, 'no tags, published'],
43
            [Uuid::uuid4(), 'A Post', 'Lorem ipsum', new Author(Uuid::uuid4(), 'Davis', '[email protected]', 'Some string', new DateTime()), [new Tag(Uuid::uuid4(),'tag1'), new Tag(Uuid::uuid4(),'tag2')], new DateTime(), Post::class, 'tags, published (most common scenario)']
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 200 characters; contains 275 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
44
        ];
45
    }
46
}
47