MetaTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 37
c 1
b 0
f 0
dl 0
loc 53
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreate() 0 41 2
A setUp() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Website\Form\Factory\Page;
6
7
use AbterPhp\Website\Domain\Entities\Page as Entity;
8
use PHPUnit\Framework\TestCase;
9
10
class MetaTest extends TestCase
11
{
12
    /** @var Meta - System Under Test */
13
    protected $sut;
14
15
    public function setUp(): void
16
    {
17
        parent::setUp();
18
19
        $this->sut = new Meta();
20
    }
21
22
    public function testCreate()
23
    {
24
        $id            = 'bde8a749-b409-43c6-a061-c6a7d2dce6a0';
25
        $identifier    = 'foo';
26
        $description   = '';
27
        $robots        = '';
28
        $author        = '';
29
        $copyright     = '';
30
        $keywords      = '';
31
        $oGTitle       = '';
32
        $ogImage       = '';
33
        $ogDescription = '';
34
35
        $meta = new Entity\Meta(
36
            $description,
37
            $robots,
38
            $author,
39
            $copyright,
40
            $keywords,
41
            $oGTitle,
42
            $ogImage,
43
            $ogDescription
44
        );
45
        $entity = new Entity($id, $identifier, '', '', '', '', false, null, '', null, $meta);
46
47
        $actualResult = $this->sut->create($entity);
48
49
        $this->assertIsArray($actualResult);
50
51
        $html = '';
52
        foreach ($actualResult as $item) {
53
            $html .= (string)$item;
54
        }
55
        $this->assertStringContainsString('description', $html);
56
        $this->assertStringContainsString('robots', $html);
57
        $this->assertStringContainsString('author', $html);
58
        $this->assertStringContainsString('copyright', $html);
59
        $this->assertStringContainsString('keywords', $html);
60
        $this->assertStringContainsString('og-title', $html);
61
        $this->assertStringContainsString('og-image', $html);
62
        $this->assertStringContainsString('og-description', $html);
63
    }
64
}
65