|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only |
|
5
|
|
|
* SPDX-FileCopyrightText: Copyright 2016 - 2018 Kopano b.v. |
|
6
|
|
|
* SPDX-FileCopyrightText: Copyright 2020 grommunio GmbH |
|
7
|
|
|
* |
|
8
|
|
|
* Tests for grommunio DAV backend class which handles grommunio related activities. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace grommunio\DAV; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @internal |
|
15
|
|
|
* |
|
16
|
|
|
* @coversNothing |
|
17
|
|
|
*/ |
|
18
|
|
|
class GrommunioDavBackendTest extends \PHPUnit_Framework_TestCase { |
|
|
|
|
|
|
19
|
|
|
protected $gDavBackend; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @see PHPUnit_Framework_TestCase::setUp() |
|
23
|
|
|
*/ |
|
24
|
|
|
protected function setUp() { |
|
25
|
|
|
$gloggerMock = $this->getMockBuilder(GLogger::class)->disableOriginalConstructor()->getMock(); |
|
26
|
|
|
$this->gDavBackend = new GrommunioDavBackend($gloggerMock); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @see PHPUnit_Framework_TestCase::tearDown() |
|
31
|
|
|
*/ |
|
32
|
|
|
protected function tearDown() { |
|
33
|
|
|
$this->gDavBackend = null; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Tests if the constructor is created without errors. |
|
38
|
|
|
*/ |
|
39
|
|
|
public function testConstruct() { |
|
40
|
|
|
$this->assertTrue(is_object($this->gDavBackend)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Tests the GetObjectIdFromObjectUri function. |
|
45
|
|
|
* |
|
46
|
|
|
* @param string $objectUri |
|
47
|
|
|
* @param string $extension |
|
48
|
|
|
* @param string $expected |
|
49
|
|
|
* |
|
50
|
|
|
* @dataProvider ObjectUriProvider |
|
51
|
|
|
*/ |
|
52
|
|
|
public function testGetObjectIdFromObjectUri($objectUri, $extension, $expected) { |
|
53
|
|
|
$this->assertEquals($expected, $this->gDavBackend->GetObjectIdFromObjectUri($objectUri, $extension)); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Provides data for testGetObjectIdFromObjectUri. |
|
58
|
|
|
* |
|
59
|
|
|
* @return array |
|
60
|
|
|
*/ |
|
61
|
|
|
public function ObjectUriProvider() { |
|
62
|
|
|
return [ |
|
63
|
|
|
['1234.ics', '.ics', '1234'], // ok, cut .ics |
|
64
|
|
|
['5678AF.vcf', '.vcf', '5678AF'], // ok, cut .vcf |
|
65
|
|
|
['123400.vcf', '.ics', '123400.vcf'], // different extension, return as is |
|
66
|
|
|
['1234.ics', '.vcf', '1234.ics'], // different extension, return as is |
|
67
|
|
|
]; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths