DoctrineAnnotationDumperTest::testExportValues()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheCodingMachine\FluidSchema;
4
5
use Exception;
6
use PHPUnit\Framework\TestCase;
7
8
class DoctrineAnnotationDumperTest extends TestCase
9
{
10
11
    public function testExportValues()
12
    {
13
        $this->assertSame('', DoctrineAnnotationDumper::exportValues(null));
14
        $this->assertSame('({})', DoctrineAnnotationDumper::exportValues([]));
15
        $this->assertSame('("foo")', DoctrineAnnotationDumper::exportValues("foo"));
16
        $this->assertSame('(foo = null)', DoctrineAnnotationDumper::exportValues(["foo"=>null]));
17
        $this->assertSame('(foo = 42)', DoctrineAnnotationDumper::exportValues(["foo"=>42]));
18
        $this->assertSame('(foo = "bar")', DoctrineAnnotationDumper::exportValues(["foo"=>"bar"]));
19
        $this->assertSame('(foo = {"bar":"baz", "baz":"bar"})', DoctrineAnnotationDumper::exportValues(["foo"=>["bar"=>"baz","baz"=>"bar"]]));
20
        $this->assertSame('(foo = {"baz", "bar"})', DoctrineAnnotationDumper::exportValues(["foo"=>["baz","bar"]]));
21
22
        $this->expectException(\RuntimeException::class);
23
        DoctrineAnnotationDumper::exportValues(new Exception());
24
    }
25
}
26