DoctrineAnnotationDumperTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExportValues() 0 14 1
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