This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace codecept\configuration; |
||
4 | |||
5 | use codecept\ApiTester; |
||
6 | use Codeception\Util\HttpCode; |
||
7 | use SlayerBirden\DataFlowServer\Db\Entities\DbConfiguration; |
||
8 | use SlayerBirden\DataFlowServer\Domain\Entities\User; |
||
9 | |||
10 | class GetConfigsCest |
||
11 | { |
||
12 | public function _before(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | $user = $I->grabEntityFromRepository(User::class, ['id' => 1]); |
||
15 | $I->haveInRepository(DbConfiguration::class, [ |
||
16 | 'owner' => $user, |
||
17 | 'title' => 'sqlite config', |
||
18 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
19 | ]); |
||
20 | $I->haveInRepository(DbConfiguration::class, [ |
||
21 | 'owner' => $user, |
||
22 | 'title' => 'mysql config', |
||
23 | 'url' => 'mysql://test-user:test-pwd@mysql/test', |
||
24 | ]); |
||
25 | for ($i = 1; $i < 10; $i++) { |
||
26 | $I->haveInRepository(DbConfiguration::class, [ |
||
27 | 'owner' => $user, |
||
28 | 'title' => sprintf('project %d config', $i), |
||
29 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
30 | ]); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | public function getAllConfigurations(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
35 | { |
||
36 | $I->wantTo('get all db configurations'); |
||
37 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
38 | $I->sendGET('/configs?l=100'); |
||
39 | $I->seeResponseCodeIs(HttpCode::OK); |
||
40 | $configs = [ |
||
41 | [ |
||
42 | 'title' => 'sqlite config', |
||
43 | ], |
||
44 | [ |
||
45 | 'title' => 'mysql config', |
||
46 | ], |
||
47 | ]; |
||
48 | $otherConfigs = []; |
||
49 | for ($i = 1; $i < 10; $i++) { |
||
50 | $otherConfigs[] = [ |
||
51 | 'title' => sprintf('project %d config', $i), |
||
52 | ]; |
||
53 | } |
||
54 | $configs = array_merge($configs, $otherConfigs); |
||
55 | $I->seeResponseContainsJson([ |
||
56 | 'data' => [ |
||
57 | 'configurations' => $configs, |
||
58 | 'count' => 11, |
||
59 | ] |
||
60 | ]); |
||
61 | } |
||
62 | |||
63 | public function getSecondPageConfigurations(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
64 | { |
||
65 | $I->wantTo('get second page of db configurations'); |
||
66 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
67 | $I->sendGET('/configs?p=2'); |
||
68 | $I->seeResponseCodeIs(HttpCode::OK); |
||
69 | $I->seeResponseContainsJson([ |
||
70 | 'data' => [ |
||
71 | 'configurations' => [ |
||
72 | [ |
||
73 | 'title' => 'project 9 config', |
||
74 | ], |
||
75 | ], |
||
76 | 'count' => 11, |
||
77 | ] |
||
78 | ]); |
||
79 | } |
||
80 | |||
81 | public function getFilteredConfigurations(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
82 | { |
||
83 | $I->wantTo('get configurations filtered by mysql'); |
||
84 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
85 | $I->sendGET('/configs?f[title]=mysql'); |
||
86 | $I->seeResponseCodeIs(HttpCode::OK); |
||
87 | $I->seeResponseContainsJson([ |
||
88 | 'data' => [ |
||
89 | 'configurations' => [ |
||
90 | [ |
||
91 | 'title' => 'mysql config', |
||
92 | ], |
||
93 | ], |
||
94 | 'count' => 1, |
||
95 | ] |
||
96 | ]); |
||
97 | } |
||
98 | |||
99 | public function getSortedConfigurations(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
100 | { |
||
101 | $I->wantTo('get configurations sorted by title asc'); |
||
102 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
103 | $I->sendGET('/configs?s[title]=asc'); |
||
104 | $I->seeResponseCodeIs(HttpCode::OK); |
||
105 | $I->seeResponseContainsJson([ |
||
106 | 'data' => [ |
||
107 | 'configurations' => [ |
||
108 | [ |
||
109 | 'title' => 'mysql config', |
||
110 | ], |
||
111 | ], |
||
112 | 'count' => 11, |
||
113 | ] |
||
114 | ]); |
||
115 | } |
||
116 | |||
117 | public function getNoResultsFilterConfigurations(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
118 | { |
||
119 | $I->wantTo('attempt to get configurations with not matching filter'); |
||
120 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
121 | $I->sendGET('/configs?f[title]=bla'); |
||
122 | $I->seeResponseCodeIs(HttpCode::NOT_FOUND); |
||
123 | $I->seeResponseContainsJson([ |
||
124 | 'data' => [ |
||
125 | 'configurations' => [], |
||
126 | 'count' => 0, |
||
127 | ] |
||
128 | ]); |
||
129 | } |
||
130 | |||
131 | public function getWrongFilterUsers(ApiTester $I) |
||
0 ignored issues
–
show
|
|||
132 | { |
||
133 | $I->wantTo('attempt to get configurations with wrong filters'); |
||
134 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
135 | $I->sendGET('/configs?f[abracadabra]=30'); |
||
136 | $I->seeResponseCodeIs(HttpCode::BAD_REQUEST); |
||
137 | $I->seeResponseContainsJson([ |
||
138 | 'data' => [ |
||
139 | 'configurations' => [], |
||
140 | 'count' => 0, |
||
141 | ] |
||
142 | ]); |
||
143 | } |
||
144 | } |
||
145 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.