DocumentTest::testReturnDataWithContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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