GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

XsdValidatorTest::tearDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Hautzi\SystemMailBundle\Tests\SystemMailer\XML;
4
5
use Hautzi\SystemMailBundle\SystemMailer\XML\XsdValidator;
6
7
class XsdValidatorTest extends \PHPUnit_Framework_TestCase
8
{
9
    protected $xsd = <<<EOL
10
<?xml version="1.0"?>
11
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
12
            targetNamespace="http://christoph-hautzinger.de/schema/system-mail-bundle"
13
            xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle"
14
            elementFormDefault="qualified">
15
16
<xs:element name="email">
17
  <xs:complexType>
18
    <xs:sequence>
19
      <xs:element name="to" type="xs:string"/>
20
      <xs:element name="from" type="xs:string"/>
21
    </xs:sequence>
22
  </xs:complexType>
23
</xs:element>
24
25
</xs:schema>
26
EOL;
27
28
    protected $validXml = <<<EOL
29
<?xml version="1.0"?>
30
<email xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle"
31
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32
       xsi:schemaLocation="http://christoph-hautzinger.de/schema/system-mail-bundle http://christoph-hautzinger.de/schema/system-mail-bundle/email-1.0.xsd">
33
  <to>hautzi</to>
34
  <from>not-hautzi</from>
35
</email>
36
EOL;
37
38
    protected $invalidXml = <<<EOL
39
<?xml version="1.0"?>
40
<email xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle"
41
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
42
       xsi:schemaLocation="http://christoph-hautzinger.de/schema/system-mail-bundle http://christoph-hautzinger.de/schema/system-mail-bundle/email-1.0.xsd">
43
  <message>hautzi</message>
44
  <from>not-hautzi</from>
45
</email>
46
EOL;
47
48
    protected $tmpXsdFile;
49
50
    protected function setUp()
51
    {
52
        $this->tmpXsdFile = tempnam('/tmp', 'FOO');
53
        file_put_contents($this->tmpXsdFile, $this->xsd);
54
    }
55
56
    protected function tearDown()
57
    {
58
        unlink($this->tmpXsdFile);
59
    }
60
61
62
    public function testValidationSuccess()
63
    {
64
        $xsd = new XsdValidator();
65
66
        $this->assertTrue($xsd->validate($this->validXml, $this->tmpXsdFile));
67
    }
68
69
    /**
70
     * @expectedException \Hautzi\SystemMailBundle\SystemMailer\XML\XsdValidationException
71
     */
72
    public function testValidationFailsThrowsException()
73
    {
74
        $xsd = new XsdValidator();
75
76
        $xsd->validate($this->invalidXml, $this->tmpXsdFile);
77
    }
78
}
79