Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

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.
Passed
Pull Request — master (#818)
by Sebastian
03:23
created

HelperTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 23
c 2
b 0
f 0
dl 0
loc 50
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A assertInvalidXml() 0 4 1
A validXmlIsAccepted() 0 11 1
A invalidXmlYieldsFalse() 0 10 1
A canConvertTimecode() 0 5 1
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Unit\Common;
4
5
use Kitodo\Dlf\Common\Helper;
6
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
7
8
class HelperTest extends UnitTestCase
9
{
10
    public function assertInvalidXml($xml)
11
    {
12
        $result = Helper::getXmlFileAsString($xml);
13
        $this->assertEquals(false, $result);
14
    }
15
16
    /**
17
     * @test
18
     * @group getXmlFileAsString
19
     */
20
    public function invalidXmlYieldsFalse(): void
21
    {
22
        $this->assertInvalidXml(false);
23
        $this->assertInvalidXml(null);
24
        $this->assertInvalidXml(1);
25
        $this->assertInvalidXml([]);
26
        $this->assertInvalidXml(new \stdClass());
27
        $this->assertInvalidXml('');
28
        $this->assertInvalidXml('not xml');
29
        $this->assertInvalidXml('<tag-not-closed>');
30
    }
31
32
    /**
33
     * @test
34
     * @group getXmlFileAsString
35
     */
36
    public function validXmlIsAccepted(): void
37
    {
38
        $xml = <<<XML
39
<?xml version="1.0" encoding="UTF-8"?>
40
<root>
41
    <single />
42
</root>
43
XML;
44
        $node = Helper::getXmlFileAsString($xml);
45
        $this->assertIsObject($node);
46
        $this->assertEquals('root', $node->getName());
47
    }
48
49
    /**
50
     * @test
51
     * @group timecodeToSeconds
52
     */
53
    public function canConvertTimecode()
54
    {
55
        $this->assertEquals(20, Helper::timecodeToSeconds('20'));
56
        $this->assertEquals(20.5, Helper::timecodeToSeconds('20.5'));
57
        $this->assertEquals(80.5, Helper::timecodeToSeconds('1:20.5'));
58
    }
59
}
60