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 (#821)
by
unknown
03:46
created

HelperTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 55
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canGetIndexNameFromUid() 0 42 2
A setUp() 0 6 1
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Functional\Common;
4
5
use Kitodo\Dlf\Common\Helper;
6
use Kitodo\Dlf\Common\Doc;
7
use Kitodo\Dlf\Common\Indexer;
8
use Kitodo\Dlf\Common\Solr;
9
use Kitodo\Dlf\Domain\Model\Collection;
10
use Kitodo\Dlf\Domain\Model\SolrCore;
11
use Kitodo\Dlf\Domain\Repository\CollectionRepository;
12
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
13
use Kitodo\Dlf\Domain\Repository\SolrCoreRepository;
14
use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
15
use TYPO3\CMS\Core\Core\Bootstrap;
16
use TYPO3\CMS\Core\Utility\GeneralUtility;
17
use TYPO3\CMS\Extbase\Object\ObjectManager;
18
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
19
20
class HelperTest extends FunctionalTestCase
21
{
22
    public function setUp(): void
23
    {
24
        parent::setUp();
25
26
        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
27
        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
28
    }
29
30
    /**
31
     * @test
32
     */
33
    public function canGetIndexNameFromUid()
34
    {
35
        // Repeat to make sure caching isn't broken
36
        for ($n = 0; $n < 2; $n++) {
37
            // Good UID, no PID
38
            $this->assertEquals(
39
                'default',
40
                Helper::getIndexNameFromUid(10001, 'tx_dlf_libraries')
41
            );
42
            $this->assertEquals(
43
                'title',
44
                Helper::getIndexNameFromUid(5001, 'tx_dlf_metadata')
45
            );
46
            $this->assertEquals(
47
                'collection',
48
                Helper::getIndexNameFromUid(5002, 'tx_dlf_metadata')
49
            );
50
51
            // Good UID, good PID
52
            $this->assertEquals(
53
                'default',
54
                Helper::getIndexNameFromUid(10001, 'tx_dlf_libraries', 20000)
55
            );
56
            $this->assertEquals(
57
                'title',
58
                Helper::getIndexNameFromUid(5001, 'tx_dlf_metadata', 20000)
59
            );
60
            $this->assertEquals(
61
                'collection',
62
                Helper::getIndexNameFromUid(5002, 'tx_dlf_metadata', 20000)
63
            );
64
65
            // Good UID, bad PID
66
            $this->assertEquals(
67
                '',
68
                Helper::getIndexNameFromUid(10001, 'tx_dlf_libraries', 123456)
69
            );
70
71
            // Bad UID, no PID
72
            $this->assertEquals(
73
                '',
74
                Helper::getIndexNameFromUid(123456, 'tx_dlf_libraries')
75
            );
76
        }
77
    }
78
}
79