Issues (83)

Tests/Unit/Model/ConfigurationTest.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\Tests\Unit\Model;
13
14
use PHPUnit\Framework\TestCase;
0 ignored issues
show
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Translation\Bundle\Model\Configuration;
16
17
class ConfigurationTest extends TestCase
18
{
19
    public function testAccessors(): void
20
    {
21
        $key2Function = self::getDefaultData();
22
        $conf = new Configuration($key2Function);
23
24
        foreach ($key2Function as $key => $value) {
25
            $func = $value;
26
            if (\is_array($func)) {
27
                $func = \reset($func);
28
            }
29
            $this->assertEquals($value, $conf->$func());
30
        }
31
    }
32
33
    public function testGetPathsToTranslationFiles(): void
34
    {
35
        $data = self::getDefaultData();
36
        $data['external_translations_dirs'] = ['foo', 'bar'];
37
        $data['output_dir'] = 'biz';
38
39
        $conf = new Configuration($data);
40
41
        $this->assertEquals(['foo', 'bar', 'biz'], $conf->getPathsToTranslationFiles());
42
    }
43
44
    public static function getDefaultData(): array
45
    {
46
        return [
47
            'name' => 'getName',
48
            'locales' => ['getLocales'],
49
            'project_root' => 'getProjectRoot',
50
            'output_dir' => 'getOutputDir',
51
            'dirs' => ['getDirs'],
52
            'excluded_dirs' => ['getExcludedDirs'],
53
            'excluded_names' => ['getExcludedNames'],
54
            'external_translations_dirs' => ['getExternalTranslationsDirs'],
55
            'output_format' => 'getOutputFormat',
56
            'blacklist_domains' => ['getBlacklistDomains'],
57
            'whitelist_domains' => ['getWhitelistDomains'],
58
            'xliff_version' => 'getXliffVersion',
59
        ];
60
    }
61
}
62