Issues (8)

tests/Unit/DemoTest.php (2 issues)

Severity
1
<?php
2
3
namespace Alive2212\LaravelRequestHelperTest\Unit;
4
5
use Illuminate\Container\Container;
6
use Illuminate\Support\Facades\Facade;
7
use PHPUnit\Framework\TestCase;
8
9
class DemoTest extends TestCase
10
{
11
    /**
12
     * @var string
13
     */
14
    private $PACKAGE_NAME = "LaravelRequestHelper";
15
16
    /**
17
     * @var array
18
     */
19
    private $PACKAGE_CLASSES = [
20
        "RequestHelper",
21
    ];
22
23
    /**
24
     * @var string
25
     */
26
    private $VENDOR = 'Alive2212';
27
28
    protected $app;
29
30
    public function __construct()
31
    {
32
        parent::__construct();
33
        $this->createApplication();
34
    }
35
36
    public function createApplication()
37
    {
38
        $app = new Container();
39
        $app->bind('app', 'Illuminate\Container\Container');
40
41
        foreach ($this->PACKAGE_CLASSES as $PACKAGE_CLASS) {
42
            $app->bind($PACKAGE_CLASS, $this->VENDOR.'\\'.$this->PACKAGE_NAME.'\\'.$PACKAGE_CLASS);
43
        }
44
45
        $app->bind('Cache', 'Illuminate\Support\Facades\Cache');
46
47
        $this->app = $app;
48
        Facade::setFacadeApplication($app);
0 ignored issues
show
$app of type Illuminate\Container\Container is incompatible with the type Illuminate\Contracts\Foundation\Application expected by parameter $app of Illuminate\Support\Facad...:setFacadeApplication(). ( Ignorable by Annotation )

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

48
        Facade::setFacadeApplication(/** @scrutinizer ignore-type */ $app);
Loading history...
49
    }
50
51
    /**
52
     * A basic test example.
53
     *
54
     * @return void
55
     */
56
    public function testBasicTest()
57
    {
58
        // create String Helper
59
        foreach ($this->PACKAGE_CLASSES as $PACKAGE_CLASS) {
60
            ${$PACKAGE_CLASS} = $this->app->make($PACKAGE_CLASS);
61
        }
62
63
        $testArray = [
0 ignored issues
show
The assignment to $testArray is dead and can be removed.
Loading history...
64
            'key1' => 'value1',
65
            'key2' => [
66
                'key21' => 'value21',
67
            ]
68
        ];
69
70
        $this->assertTrue(true);
71
    }
72
}
73