|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This is part of the webuni/front-matter package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Martin Hasoň <[email protected]> |
|
7
|
|
|
* (c) Webuni s.r.o. <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Webuni\FrontMatter\Tests; |
|
14
|
|
|
|
|
15
|
|
|
use PHPUnit\Framework\TestCase; |
|
16
|
|
|
use Webuni\FrontMatter\Document; |
|
17
|
|
|
|
|
18
|
|
|
class DocumentTest extends TestCase |
|
19
|
|
|
{ |
|
20
|
|
|
public function testReturnContent() |
|
21
|
|
|
{ |
|
22
|
|
|
$document = new Document($content = 'content'); |
|
23
|
|
|
$this->assertEquals($content, $document->getContent()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testReturnData() |
|
27
|
|
|
{ |
|
28
|
|
|
$document = new Document('content', $data = ['foo' => 'bar']); |
|
29
|
|
|
$this->assertEquals($data, $document->getData()); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function testReturnDataWithContent() |
|
33
|
|
|
{ |
|
34
|
|
|
$document = new Document($content = 'content', ['foo' => 'bar']); |
|
35
|
|
|
$this->assertEquals(['foo' => 'bar', '__content' => $content], $document->getDataWithContent()); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testSetContent() |
|
39
|
|
|
{ |
|
40
|
|
|
$document = new Document(''); |
|
41
|
|
|
$document->setContent($content = 'content'); |
|
42
|
|
|
$this->assertEquals($content, $document->getContent()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testSetData() |
|
46
|
|
|
{ |
|
47
|
|
|
$document = new Document(''); |
|
48
|
|
|
$document->setData($data = ['foo' => 'bar']); |
|
49
|
|
|
$this->assertEquals($data, $document->getData()); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|