Test Failed
Push — master ( 5b1898...c6e89f )
by Christopher
11:45 queued 05:22
created

EdmxTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsOKAtDefault() 0 6 1
A testDefaultSerializeOk() 0 13 1
A V3MetadataAgainstXSD() 0 7 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\Tests;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edmx\Edmx;
6
7
class EdmxTest extends TestCase
8
{
9
    public function testIsOKAtDefault()
10
    {
11
        $msg = null;
12
        $edmx = new Edmx();
13
        $this->assertTrue($edmx->isOK($msg), $msg);
14
    }
15
16
    public function testDefaultSerializeOk()
17
    {
18
        $msg = null;
19
        $edmx = new Edmx();
20
        $this->assertTrue($edmx->isOK($msg), $msg);
21
        $ymlDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR . "MetadataV3" . DIRECTORY_SEPARATOR . "JMSmetadata";
22
        $serializer =
23
            \JMS\Serializer\SerializerBuilder::create()
24
                ->addMetadataDir($ymlDir)
25
                ->build();
26
        $d = $serializer->serialize($edmx, "xml");
27
        $this->V3MetadataAgainstXSD($d);
28
    }
29
30
    public function V3MetadataAgainstXSD($data)
31
    {
32
33
        $xml = new \DOMDocument();
34
        $xml->loadXML($data);
35
        $xml->schemaValidate(dirname(__DIR__) . DIRECTORY_SEPARATOR . "xsd" . DIRECTORY_SEPARATOR . "/Microsoft.Data.Entity.Design.Edmx_3.xsd");
36
    }
37
}
38