Test Setup Failed
Push — develop ( fb72f9...afdb67 )
by Joseph
03:04
created

TestCase.php$0 ➔ decrypt()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Tests;
4
5
use Config;
6
use EnvSecurity;
0 ignored issues
show
Bug introduced by
The type EnvSecurity 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...
7
use Orchestra\Testbench\TestCase as BaseTestCase;
8
use STS\EnvSecurity\EnvSecurityFacade;
9
use STS\EnvSecurity\EnvSecurityServiceProvider;
10
11
abstract class TestCase extends BaseTestCase
12
{
13
    protected function getPackageProviders($app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
    protected function getPackageProviders(/** @scrutinizer ignore-unused */ $app)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        return [EnvSecurityServiceProvider::class];
16
    }
17
18
    protected function getPackageAliases($app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

18
    protected function getPackageAliases(/** @scrutinizer ignore-unused */ $app)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        return [
21
            'EnvSecurity' => EnvSecurityFacade::class
22
        ];
23
    }
24
25
    protected function setUp(): void
26
    {
27
        parent::setUp();
28
29
        EnvSecurity::extend('laravel', function() {
30
            return app('encrypter');
31
        });
32
33
        EnvSecurity::extend('test', function() {
34
            return new class {
35
                public function encrypt($plaintext) {
36
                    return base64_encode($plaintext);
37
                }
38
39
                public function decrypt($ciphertext) {
40
                    return base64_decode($ciphertext);
41
                }
42
            };
43
        });
44
45
        Config::set('env-security.default', 'test');
46
        Config::set('env-security.store', __DIR__ . '/store');
47
        Config::set('env-security.destination', __DIR__ . '/.env-saved');
48
    }
49
}