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 (#895)
by
unknown
07:25 queued 03:39
created

MetadataRepositoryTest::canFindBySettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 22
nc 1
nop 0
dl 0
loc 31
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Functional\Repository;
4
5
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
6
use Kitodo\Dlf\Domain\Repository\MetadataRepository;
7
use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
8
9
class MetadataRepositoryTest extends FunctionalTestCase
10
{
11
    /**
12
     * @var MetadataRepository
13
     */
14
    protected $metadataRepository;
15
16
    public function setUp(): void
17
    {
18
        parent::setUp();
19
20
        $this->metadataRepository = $this->initializeRepository(
21
            MetadataRepository::class,
22
            20000
23
        );
24
25
        $this->importDataSet(__DIR__ . '/../../Fixtures/Repository/metadata.xml');
0 ignored issues
show
Deprecated Code introduced by
The function TYPO3\TestingFramework\C...stCase::importDataSet() has been deprecated: Will be removed with core v12 compatible testing-framework. Importing database fixtures based on XML format is discouraged. Switch to CSV format instead. See core functional tests or styleguide for many examples how these look like. Use method importCSVDataSet() to import such fixture files and assertCSVDataSet() to compare database state with fixture files. ( Ignorable by Annotation )

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

25
        /** @scrutinizer ignore-deprecated */ $this->importDataSet(__DIR__ . '/../../Fixtures/Repository/metadata.xml');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
26
    }
27
28
29
    /**
30
     * @param $settings
31
     * @return array
32
     */
33
    protected function findBySettings($settings)
34
    {
35
        $metadata = $this->metadataRepository->findBySettings($settings);
36
        $this->assertNotNull($metadata);
37
        $this->assertInstanceOf(QueryResult::class, $metadata);
38
39
        $metadataByLabel = [];
40
        foreach ($metadata as $mdata) {
41
            $metadataByLabel[$mdata->getLabel()] = $mdata;
42
        }
43
44
        return $metadataByLabel;
45
    }
46
47
    /**
48
     * @test
49
     * @group find
50
     */
51
    public function canFindBySettings(): void
52
    {
53
        $metadataByLabel = $this->findBySettings([]);
54
        $this->assertEquals(6, sizeof($metadataByLabel));
55
        $this->assertEquals(
56
            'Ort, Untertitel, Autor, Institution, Sammlungen, Titel',
57
            implode(', ', array_keys($metadataByLabel))
58
        );
59
60
        $metadataByLabel = $this->findBySettings(['is_listed' => true]);
61
        $this->assertEquals(3, sizeof($metadataByLabel));
62
        $this->assertEquals(
63
            'Autor, Institution, Titel',
64
            implode(', ', array_keys($metadataByLabel))
65
        );
66
67
        $metadataByLabel = $this->findBySettings(['is_sortable' => true]);
68
        $this->assertEquals(4, sizeof($metadataByLabel));
69
        $this->assertEquals(
70
            'Ort, Untertitel, Autor, Titel',
71
            implode(', ', array_keys($metadataByLabel))
72
        );
73
74
        $metadataByLabel = $this->findBySettings([
75
            'is_sortable' => true,
76
            'is_listed' => true
77
        ]);
78
        $this->assertEquals(2, sizeof($metadataByLabel));
79
        $this->assertEquals(
80
            'Autor, Titel',
81
            implode(', ', array_keys($metadataByLabel))
82
        );
83
    }
84
}
85