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 | use Qualia\Client; |
||
4 | use Qualia\Exceptions\ConnectionErrorException; |
||
5 | use Qualia\Exceptions\EmailExistsException; |
||
6 | use Qualia\Exceptions\RequestException; |
||
7 | use Qualia\Submission\Entry; |
||
8 | |||
9 | class EntryTest extends TestCase |
||
10 | { |
||
11 | |||
12 | public function testInvalidCredentials() |
||
13 | { |
||
14 | self::setExpectedException("\\Qualia\\Exceptions\\RequestException"); |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | Entry::build(new Client('597768e728d8f1508f6d9f62', 'invalid-credentials')) |
||
17 | ->email('q_tVabQ3cUlwZTgQ10', '[email protected]') |
||
18 | ->send(); |
||
19 | |||
20 | } |
||
21 | |||
22 | public function testInvalidSurvey() |
||
23 | { |
||
24 | self::setExpectedException("\\Qualia\\Exceptions\\RequestException"); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
25 | |||
26 | Entry::build(new Client('aaa', 'cT6hCqyxD8MQ0k6gfYwWBt3lIMexpsLQ')) |
||
27 | ->email('q_tVabQ3cUlwZTgQ10', '[email protected]') |
||
28 | ->send(); |
||
29 | |||
30 | } |
||
31 | |||
32 | public function testServerError() |
||
33 | { |
||
34 | try { |
||
35 | Entry::build(new Client('aaa', 'cT6hCqyxD8MQ0k6gfYwWBt3lIMexpsLQ', 'api.qualiaanalytics.test')) |
||
36 | ->email('q_tVabQ3cUlwZTgQ10', '[email protected]') |
||
37 | ->send(); |
||
38 | } catch (ConnectionErrorException $e) { |
||
39 | self::assertTrue(true); |
||
40 | } catch (RequestException $e) { |
||
41 | self::assertFalse(true); |
||
42 | } |
||
43 | } |
||
44 | |||
45 | public function testValidationException() |
||
46 | { |
||
47 | try { |
||
48 | Entry::build($this->client) |
||
49 | ->email('dadad', '[email protected]') |
||
50 | ->send(); |
||
51 | } catch (ConnectionErrorException $e) { |
||
52 | self::assertTrue(false); |
||
53 | } catch (EmailExistsException $e) { |
||
54 | self::assertTrue(false); |
||
55 | } catch (RequestException $e) { |
||
56 | self::assertTrue(true); |
||
57 | self::assertEquals(400, $e->getCode()); |
||
58 | self::assertEquals("Invalid Question: dadad", $e->getMessage()); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | public function testFailsWithoutData() |
||
63 | { |
||
64 | self::setExpectedException("InvalidArgumentException"); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
65 | |||
66 | Entry::build($this->client) |
||
67 | ->send(); |
||
68 | } |
||
69 | |||
70 | public function allowsOnlyCorrectDateNotUnixTime() |
||
71 | { |
||
72 | self::setExpectedException("InvalidArgumentException"); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
73 | |||
74 | $id = uniqid('', true); |
||
75 | |||
76 | Entry::build($this->client) |
||
77 | ->uniqueId($id) |
||
78 | ->date('q_1J75WdyBwVpwlJUM', time()) |
||
79 | ->send(); |
||
80 | } |
||
81 | |||
82 | public function testAllowsOnlyCorrectDate() |
||
83 | { |
||
84 | self::setExpectedException("InvalidArgumentException"); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
85 | |||
86 | Entry::build($this->client) |
||
87 | ->date('q_1J75WdyBwVpwlJUM', 'invalid') |
||
88 | ->send(); |
||
89 | } |
||
90 | |||
91 | public function testCreatesEntryWithEmail() |
||
92 | { |
||
93 | $id = uniqid('', true); |
||
94 | |||
95 | $response = Entry::build($this->client) |
||
96 | ->uniqueId($id) |
||
97 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
98 | ->send(); |
||
99 | |||
100 | self::assertEquals('success', $response['message']); |
||
101 | self::assertArrayHasKey('id', $response); |
||
102 | } |
||
103 | |||
104 | public function testSingleCheckbox() |
||
105 | { |
||
106 | $id = uniqid('', true); |
||
107 | |||
108 | $response = Entry::build($this->client) |
||
109 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
110 | ->response('q_tVabQ3cUlwZTgQ10', 'o_ACvo61cUuKXxD5C1') |
||
111 | ->send(); |
||
112 | |||
113 | self::assertEquals('success', $response['message']); |
||
114 | self::assertArrayHasKey('id', $response); |
||
115 | } |
||
116 | |||
117 | public function testSubmitWithLanguage() |
||
118 | { |
||
119 | $response = Entry::build($this->client) |
||
120 | ->language('en') |
||
121 | ->date('q_1J75WdyBwVpwlJUM', date('Y-m-d')) |
||
122 | ->send(); |
||
123 | |||
124 | self::assertEquals('success', $response['message']); |
||
125 | self::assertArrayHasKey('id', $response); |
||
126 | } |
||
127 | |||
128 | public function testSubmitWithInvalidLanguage() |
||
129 | { |
||
130 | $response = Entry::build($this->client) |
||
0 ignored issues
–
show
$response is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
131 | ->language('xy') |
||
132 | ->date('q_1J75WdyBwVpwlJUM', date('Y-m-d')) |
||
133 | ->send(); |
||
134 | |||
135 | // will allow to submit and sets language as default one |
||
136 | } |
||
137 | |||
138 | public function testSubmitDuplicateEmail() |
||
139 | { |
||
140 | $id = uniqid('', true); |
||
141 | |||
142 | $response = Entry::build($this->client) |
||
0 ignored issues
–
show
$response is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
143 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
144 | ->send(); |
||
145 | |||
146 | // allowDuplicates will allow to submit |
||
147 | $response = Entry::build($this->client) |
||
0 ignored issues
–
show
$response is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
148 | ->allowDuplicates() |
||
149 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
150 | ->send(); |
||
151 | |||
152 | try { |
||
153 | // will throw an exception |
||
154 | $response = Entry::build($this->client) |
||
0 ignored issues
–
show
$response is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
155 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
156 | ->send(); |
||
157 | } catch (EmailExistsException $e) { |
||
158 | self::assertTrue(strlen($e->getEntryId()) > 0); |
||
159 | return; |
||
160 | } |
||
161 | |||
162 | self::assertFalse(true, "Exception was not thrown"); |
||
163 | } |
||
164 | |||
165 | public function testWithAllFields() |
||
166 | { |
||
167 | $id = uniqid('', true); |
||
168 | |||
169 | $response = Entry::build($this->client) |
||
170 | ->uniqueId($id) |
||
171 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
172 | ->name('q_KCyzOs7VqevWbEO0', "Unit", "Tester") |
||
173 | ->date('q_1J75WdyBwVpwlJUM', date('Y-m-d')) |
||
174 | ->response('q_KCyzOs7VqevWbEO0', ['o_wCcuY5a54YBeXLC1', 'o_ACvo61cUuKXxD5C1']) |
||
175 | ->send(); |
||
176 | |||
177 | self::assertEquals('success', $response['message']); |
||
178 | self::assertArrayHasKey('id', $response); |
||
179 | } |
||
180 | |||
181 | public function testCreatesEntryWithEmailAndMarksCompleted() |
||
182 | { |
||
183 | $id = uniqid('', true); |
||
184 | |||
185 | $response = Entry::build($this->client) |
||
186 | ->uniqueId($id) |
||
187 | ->email('q_3RYJ4MpggyMFuU50', $id."[email protected]") |
||
188 | ->send(true); |
||
189 | |||
190 | self::assertEquals('success', $response['message']); |
||
191 | self::assertArrayHasKey('id', $response); |
||
192 | } |
||
193 | } |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.