aboutsummaryrefslogtreecommitdiff
path: root/test/View/OutputTest.php
blob: f687ee840f0e4dd9482be19776e004ff6f6826d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

declare(strict_types=1);

namespace AugustOffensive\View;

use PHPUnit\Framework\TestCase;
use AugustOffensive\Model;

/**
 * @covers Output
 */
final class OutputTest extends \PHPUnit\Framework\TestCase
{
    public function testJSONOutput()
    {
        $resultType = "JSON_ENCODED";
        $result = array("json", "1.6");
        $resultObject = new Model\Result($resultType, $result);

        // If JSON is properly formatted, we can decode and test the values
        $output = json_decode(Output::json($resultObject), true);

        $this->assertEquals(
            $resultType,
            $output["Result-Type"]
        );
        $this->assertEquals(
            $result,
            $output["Content"]
        );
    }
}