Passed
Pull Request — master (#24)
by Dmitriy
37:45 queued 22:43
created

HelperTest::assertSameWithoutLE()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Yiisoft\Composer\Config\Tests\Unit\Util;
4
5
use PHPUnit\Framework\TestCase;
6
use Yiisoft\Composer\Config\Util\Helper;
7
use Yiisoft\Composer\Config\Util\RemoveArrayKeys;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Composer\Config\Util\RemoveArrayKeys 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...
8
9
final class HelperTest extends TestCase
10
{
11
    public function testExportClosure(): void
12
    {
13
        $params = ['test' => 42];
14
        $closure = static function () use ($params) {
15
            return $params['test'];
16
        };
17
18
        $exportedClosure = Helper::exportVar($closure);
19
20
        $this->assertSameWithoutLE("static function () use (\$params) {\n            return \$params['test'];\n        }", $exportedClosure);
21
    }
22
23
    private function assertSameWithoutLE($expected, $actual, string $message = ''): void
24
    {
25
        $expected = preg_replace('/\R/', "\n", $expected);
26
        $actual = preg_replace('/\R/', "\n", $actual);
27
        $this->assertSame($expected, $actual, $message);
28
    }
29
}
30