1 | <?php |
||||||
2 | |||||||
3 | namespace Alive2212\LaravelSmartResponseTest\Unit; |
||||||
4 | |||||||
5 | use Alive2212\LaravelSmartMeta\Cache; |
||||||
0 ignored issues
–
show
|
|||||||
6 | use Alive2212\LaravelSmartMeta\SmartMeta; |
||||||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
7 | use Alive2212\LaravelSmartMeta\SmartMetaClass; |
||||||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
8 | use Alive2212\LaravelSmartResponse\ResponseModel; |
||||||
9 | use Illuminate\Container\Container; |
||||||
10 | use Illuminate\Database\Eloquent\Model; |
||||||
0 ignored issues
–
show
The type
Illuminate\Database\Eloquent\Model 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
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 = "LaravelSmartResponse"; |
||||||
20 | |||||||
21 | /** |
||||||
22 | * @var array |
||||||
23 | */ |
||||||
24 | private $PACKAGE_CLASSES = [ |
||||||
25 | "ResponseModel", |
||||||
26 | "SmartResponse", |
||||||
27 | ]; |
||||||
28 | |||||||
29 | /** |
||||||
30 | * @var string |
||||||
31 | */ |
||||||
32 | private $VENDOR = 'Alive2212'; |
||||||
33 | |||||||
34 | protected $app; |
||||||
35 | |||||||
36 | public function __construct() |
||||||
37 | { |
||||||
38 | parent::__construct(); |
||||||
39 | $this->createApplication(); |
||||||
40 | } |
||||||
41 | |||||||
42 | public function createApplication() |
||||||
43 | { |
||||||
44 | $app = new Container(); |
||||||
45 | $app->bind('app', 'Illuminate\Container\Container'); |
||||||
46 | |||||||
47 | foreach ($this->PACKAGE_CLASSES as $PACKAGE_CLASS) { |
||||||
48 | $app->bind($PACKAGE_CLASS, $this->VENDOR.'\\'.$this->PACKAGE_NAME.'\\'.$PACKAGE_CLASS); |
||||||
49 | } |
||||||
50 | |||||||
51 | $app->bind('Cache', 'Illuminate\Support\Facades\Cache'); |
||||||
52 | |||||||
53 | $this->app = $app; |
||||||
54 | 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
![]() |
|||||||
55 | } |
||||||
56 | |||||||
57 | /** |
||||||
58 | * A basic test example. |
||||||
59 | * |
||||||
60 | * @return void |
||||||
61 | */ |
||||||
62 | public function testBasicTest() |
||||||
63 | { |
||||||
64 | // create String Helper |
||||||
65 | foreach ($this->PACKAGE_CLASSES as $PACKAGE_CLASS) { |
||||||
66 | ${$PACKAGE_CLASS} = $this->app->make($PACKAGE_CLASS); |
||||||
67 | } |
||||||
68 | |||||||
69 | $ResponseModel = new ResponseModel(); |
||||||
70 | |||||||
71 | $testArray = [ |
||||||
72 | 'key1' => 'value1', |
||||||
73 | 'key2' => [ |
||||||
74 | 'key21' => 'value21', |
||||||
75 | ] |
||||||
76 | ]; |
||||||
77 | |||||||
78 | $ResponseModel->setStatus(true); |
||||||
0 ignored issues
–
show
The method
setStatus() does not exist on Alive2212\LaravelSmartResponse\ResponseModel . Did you maybe mean setStatusCode() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
79 | $this->assertTrue($ResponseModel->getStatus()); |
||||||
0 ignored issues
–
show
The method
getStatus() does not exist on Alive2212\LaravelSmartResponse\ResponseModel . Did you maybe mean getStatusCode() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
80 | |||||||
81 | $ResponseModel->setStatusCode(200); |
||||||
82 | $this->assertTrue($ResponseModel->getStatusCode()==200); |
||||||
83 | |||||||
84 | $ResponseModel->setMessage('test message'); |
||||||
85 | $this->assertTrue($ResponseModel->getMessage() == 'test message'); |
||||||
86 | |||||||
87 | $ResponseModel->setData(collect(['hello'])); |
||||||
88 | $this->assertTrue($ResponseModel->getData()->toArray() == ['hello']); |
||||||
89 | |||||||
90 | $ResponseModel->setBeautifulData(collect(['data'=>$testArray]), ['key1' => 'key1']); |
||||||
91 | |||||||
92 | $this->assertTrue(is_array($ResponseModel->getData()->toArray())); |
||||||
93 | } |
||||||
94 | } |
||||||
95 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths