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 — dev-extbase-fluid (#756)
by
unknown
03:39
created

DocumentRepositoryTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 24
c 1
b 0
f 0
dl 0
loc 58
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A canRetrieveDocument() 0 10 1
A canFindOldestDocument() 0 5 1
A canGetCollectionsOfDocument() 0 12 2
A setUp() 0 9 1
1
<?php
2
3
namespace Kitodo\Dlf\Tests\Functional\Repository;
4
5
use Kitodo\Dlf\Common\Doc;
6
use Kitodo\Dlf\Common\MetsDocument;
7
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
8
use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
9
use TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage;
10
11
class DocumentRepositoryTest extends FunctionalTestCase
12
{
13
    /**
14
     * @var DocumentRepository
15
     */
16
    protected $documentRepository;
17
18
    public function setUp(): void
19
    {
20
        parent::setUp();
21
22
        $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000);
23
24
        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
25
        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
26
        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
27
    }
28
29
    /**
30
     * @test
31
     */
32
    public function canRetrieveDocument(): void
33
    {
34
        $document = $this->documentRepository->findByUid(1001);
35
        $this->assertNotNull($document);
36
        $this->assertEquals('METS', $document->getDocumentFormat());
37
        $this->assertNotEmpty($document->getTitle());
38
        $this->assertEquals('Default Library', $document->getOwner()->getLabel());
39
40
        $doc = Doc::getInstance($document->getLocation());
41
        $this->assertInstanceOf(MetsDocument::class, $doc);
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function canFindOldestDocument(): void
48
    {
49
        $document = $this->documentRepository->findOldestDocument();
50
        $this->assertNotNull($document);
51
        $this->assertEquals(1002, $document->getUid());
52
    }
53
54
    /**
55
     * @test
56
     */
57
    public function canGetCollectionsOfDocument(): void
58
    {
59
        $document = $this->documentRepository->findByUid(1001);
60
        $collections = $document->getCollections();
61
        $this->assertInstanceOf(LazyObjectStorage::class, $collections);
62
63
        $collectionsByLabel = [];
64
        foreach ($collections as $collection) {
65
            $collectionsByLabel[$collection->getLabel()] = $collection;
66
        }
67
68
        $this->assertArrayHasKey('Musik', $collectionsByLabel);
69
    }
70
}
71