1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
4
|
|
|
* |
5
|
|
|
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics) |
6
|
|
|
* |
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU Affero General Public License as published |
9
|
|
|
* by the Free Software Foundation, either version 3 of the License, or |
10
|
|
|
* (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
18
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace App\Tests\Twig; |
22
|
|
|
|
23
|
|
|
use App\Twig\UserExtension; |
24
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
25
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
26
|
|
|
|
27
|
|
|
class UserExtensionTest extends WebTestCase |
28
|
|
|
{ |
29
|
|
|
protected $service; |
30
|
|
|
|
31
|
|
|
protected function setUp(): void |
32
|
|
|
{ |
33
|
|
|
self::bootKernel(); |
34
|
|
|
$this->service = self::getContainer()->get(UserExtension::class); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function removeeLocaleFromPathDataSet() |
38
|
|
|
{ |
39
|
|
|
yield ['/', '/de/']; |
40
|
|
|
yield ['/test', '/de/test']; |
41
|
|
|
yield ['/test/foo', '/en/test/foo']; |
42
|
|
|
yield ['/test/foo/bar?param1=val1¶m2=val2', '/en/test/foo/bar?param1=val1¶m2=val2']; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @dataProvider removeeLocaleFromPathDataSet |
47
|
|
|
* @param string $expected |
48
|
|
|
* @param string $input |
49
|
|
|
* @return void |
50
|
|
|
*/ |
51
|
|
|
public function testRemoveLocaleFromPath(string $expected, string $input): void |
52
|
|
|
{ |
53
|
|
|
$this->assertEquals($expected, $this->service->removeLocaleFromPath($input)); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function testRemoveLocaleFromPathException(): void |
57
|
|
|
{ |
58
|
|
|
$this->expectException(\InvalidArgumentException::class); |
59
|
|
|
$this->service->removeLocaleFromPath('/part/info/1'); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
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