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.

getSampleXslForTransformation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * Copyright 2016 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO\Test\ResponseTransformer;
19
20
use ApaiIO\ResponseTransformer\Xslt;
21
use PHPUnit\Framework\TestCase;
22
23
class XsltTransformerTest extends TestCase
24
{
25
    protected function setUp()
26
    {
27
        if (!extension_loaded('xsl')) {
28
            $this->markTestSkipped('You need to activate XSLT to run this test.');
29
        }
30
    }
31
32
    public function testXsltResponseTransformer()
33
    {
34
        $responseTransformer = new Xslt($this->getSampleXslForTransformation());
35
36
        $result = $responseTransformer->transform($this->getSampleXmlForTransformation());
37
38
        $this->assertEquals(
39
            'Fight for your mind by Ben Harper - 1995',
40
            trim($result)
41
        );
42
    }
43
44
    private function getSampleXmlForTransformation()
45
    {
46
        return <<<EOF
47
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
48
<collection>
49
 <cd>
50
  <title>Fight for your mind</title>
51
  <artist>Ben Harper</artist>
52
  <year>1995</year>
53
 </cd>
54
</collection>
55
EOF;
56
    }
57
58
    private function getSampleXslForTransformation()
59
    {
60
        return <<<EOF
61
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
62
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
63
 <xsl:param name="owner" select="'Nicolas Eliaszewicz'"/>
64
 <xsl:output method="html" encoding="utf-8" indent="no"/>
65
 <xsl:template match="collection">
66
  <xsl:apply-templates/>
67
 </xsl:template>
68
 <xsl:template match="cd">
69
  <xsl:value-of select="title"/> by <xsl:value-of select="artist"/> - <xsl:value-of select="year"/>
70
 </xsl:template>
71
</xsl:stylesheet>
72
EOF;
73
    }
74
}
75