Passed
Pull Request — master (#123)
by
unknown
05:34
created

AudioVideoMDTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A canExtractDuration() 0 16 1
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Tests\Unit\Format;
14
15
use Kitodo\Dlf\Format\AudioVideoMD;
16
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
17
18
class AudioVideoMDTest extends UnitTestCase
19
{
20
    protected $metadata = [];
21
22
    public function setUp(): void
23
    {
24
        parent::setUp();
25
26
        $this->metadata = [
27
            'duration' => [],
28
            'video_duration' => [],
29
            'audio_duration' => []
30
        ];
31
    }
32
33
    /**
34
     * @test
35
     * @group extractMetadata
36
     */
37
    public function canExtractDuration(): void
38
    {
39
        $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/audioVideo.xml');
40
        $audioVideoMD = new AudioVideoMD();
41
42
        $videoXml = $xml->xpath('//mets:xmlData')[0];
43
44
        $audioVideoMD->extractMetadata($videoXml, $this->metadata);
45
46
        self::assertEquals(
47
            [
48
                'duration' => ["00:01:30.07"],
49
                'video_duration' => ["00:01:30.07"],
50
                'audio_duration' => ["01:10:35.08"]
51
            ],
52
            $this->metadata
53
        );
54
    }
55
}
56