DemoTest::testBasicTest()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 15
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Alive2212\LaravelSmartRestfulTest\Unit;
4
5
use Alive2212\LaravelSmartMeta\Cache;
0 ignored issues
show
Bug introduced by
The type Alive2212\LaravelSmartMeta\Cache 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...
6
use Alive2212\LaravelSmartMeta\SmartMeta;
0 ignored issues
show
Bug introduced by
The type Alive2212\LaravelSmartMeta\SmartMeta 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 Alive2212\LaravelSmartMeta\SmartMetaClass;
0 ignored issues
show
Bug introduced by
The type Alive2212\LaravelSmartMeta\SmartMetaClass 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
use Alive2212\LaravelSmartResponse\ResponseModel;
9
use Illuminate\Container\Container;
10
use Illuminate\Database\Eloquent\Model;
11
use Illuminate\Support\Facades\Facade;
12
use PHPUnit\Framework\TestCase;
13
14
class DemoTest extends TestCase
15
{
16
    /**
17
     * @var string
18
     */
19
    private $PACKAGE_NAME = "LaravelSmartRestful";
20
21
    /**
22
     * @var array
23
     */
24
    private $PACKAGE_CLASSES = [
25
//        "BaseAuthModel",
26
        "BaseController",
27
//        "BaseModel",
28
    ];
29
30
    /**
31
     * @var string
32
     */
33
    private $VENDOR = 'Alive2212';
34
35
    protected $app;
36
37
    public function __construct()
38
    {
39
        parent::__construct();
40
        $this->createApplication();
41
    }
42
43
    public function createApplication()
44
    {
45
        $app = new Container();
46
        $app->bind('app', 'Illuminate\Container\Container');
47
48
        foreach ($this->PACKAGE_CLASSES as $PACKAGE_CLASS) {
49
            $app->bind($PACKAGE_CLASS, $this->VENDOR.'\\'.$this->PACKAGE_NAME.'\\'.$PACKAGE_CLASS);
50
        }
51
52
        $app->bind('Cache', 'Illuminate\Support\Facades\Cache');
53
54
        $this->app = $app;
55
        Facade::setFacadeApplication($app);
0 ignored issues
show
Bug introduced by
$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

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