Test Setup Failed
Push — static-analysis ( af1336...1f5c7e )
by SignpostMarv
06:23
created

ImportTest::testBase()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 22
nc 1
nop 0
1
<?php
2
namespace GoetasWebservices\XML\XSDReader\Tests;
3
4
class ImportTest extends BaseTest
5
{
6
7
8
    public function testBase()
9
    {
10
        $remoteSchema = $this->reader->readString(
11
            '
12
            <xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
13
                <xs:attribute name="myAttribute" type="xs:string"></xs:attribute>
14
            </xs:schema>', 'http://www.example.com/xsd.xsd');
15
16
17
        $schema = $this->reader->readString(
18
            '
19
            <xs:schema targetNamespace="http://www.user.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"  xmlns:ex="http://www.example.com">
20
                <xs:import schemaLocation="http://www.example.com/xsd.xsd" namespace="http://www.example.com"></xs:import>
21
22
                <xs:attributeGroup name="myAttributeGroup">
23
                    <xs:attribute ref="ex:myAttribute"></xs:attribute>
24
                </xs:attributeGroup>
25
26
            </xs:schema>');
27
28
        $this->assertContains($remoteSchema, $schema->getSchemas(), false, true);
0 ignored issues
show
Bug introduced by
false of type false is incompatible with the type string expected by parameter $message of PHPUnit_Framework_Assert::assertContains(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        $this->assertContains($remoteSchema, $schema->getSchemas(), /** @scrutinizer ignore-type */ false, true);
Loading history...
29
30
        $remoteAttr = $remoteSchema->findAttribute("myAttribute", "http://www.example.com");
31
        $localAttr = $schema->findAttribute("myAttribute", "http://www.example.com");
32
33
        $this->assertSame($remoteAttr, $localAttr);
34
35
        $localAttrGroup = $schema->findAttributeGroup("myAttributeGroup", "http://www.user.com");
36
        $localAttrs = $localAttrGroup->getAttributes();
37
38
        $this->assertSame($remoteAttr, $localAttrs[0]);
39
    }
40
}
41