Passed
Pull Request — master (#25)
by Alexander
14:50
created

IntlTestHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A resetIntlStatus() 0 3 1
A setIntlStatus() 0 10 3
1
<?php
2
namespace Yiisoft\Validator\Tests;
3
4
class IntlTestHelper
5
{
6
    public static $enableIntl;
7
    /**
8
     * Emulate disabled intl extension.
9
     *
10
     * Enable it only for tests prefixed with testIntl.
11
     * @param Testcase $test
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Tests\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...
12
     */
13
    public static function setIntlStatus($test)
14
    {
15
        static::$enableIntl = null;
16
        if (strncmp($test->getName(false), 'testIntl', 8) === 0) {
17
            static::$enableIntl = true;
18
            if (!extension_loaded('intl')) {
19
                $test->markTestSkipped('intl extension is not installed.');
20
            }
21
        } else {
22
            static::$enableIntl = false;
23
        }
24
    }
25
    public static function resetIntlStatus()
26
    {
27
        static::$enableIntl = null;
28
    }
29
}
30