|
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
|
|
|
|