-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathLanguagesTest.php
47 lines (43 loc) · 1.28 KB
/
LanguagesTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
* This file is part of Aplus Framework Routing Library.
*
* (c) Natan Felles <natanfelles@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Routing;
use PHPUnit\Framework\TestCase;
final class LanguagesTest extends TestCase
{
protected string $langDir = __DIR__ . '/../src/Languages/';
/**
* @return array<int,string>
*/
protected function getCodes() : array
{
// @phpstan-ignore-next-line
$codes = \array_filter((array) \glob($this->langDir . '*'), 'is_dir');
$length = \strlen($this->langDir);
$result = [];
foreach ($codes as $dir) {
if ($dir === false) {
continue;
}
$result[] = \substr($dir, $length);
}
return $result;
}
public function testKeys() : void
{
$rules = require $this->langDir . 'en/routing.php';
$rules = \array_keys($rules);
foreach ($this->getCodes() as $code) {
$lines = require $this->langDir . $code . '/routing.php';
$lines = \array_keys($lines);
\sort($lines);
self::assertSame($rules, $lines, 'Language: ' . $code);
}
}
}