Skip to content

Commit 5442b01

Browse files
committed
PEAR/MultiLineCondition: add unit tests verifying behaviour round PHPCS annotations
... and in part also, normal comments.
1 parent c926d0b commit 5442b01

File tree

5 files changed

+272
-0
lines changed

5 files changed

+272
-0
lines changed

src/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.inc

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,64 @@ if ($a
188188
?>
189189
<?php endif; ?>
190190
<?php endforeach; ?>
191+
<?php
192+
193+
if ($IPP->errorCode() == 401 || // phpcs:ignore Standard.Category.Sniff -- for reasons.
194+
$IPP->errorCode() == 3200) /*
195+
phpcs:ignore Standard.Category.Sniff -- for reasons.
196+
*/
197+
{
198+
return false;
199+
}
200+
201+
if ($IPP->errorCode() == 401 || // phpcs:disable Standard.Category.Sniff -- for reasons.
202+
$IPP->errorCode() == 3200) // phpcs:enable
203+
{
204+
return false;
205+
}
206+
207+
if ($IPP->errorCode() == 401
208+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
209+
|| $IPP->errorCode() == 3200
210+
) {
211+
return false;
212+
}
213+
214+
if ($IPP->errorCode() == 401 ||
215+
/*
216+
* phpcs:disable Standard.Category.Sniff -- for reasons.
217+
*/
218+
$IPP->errorCode() == 3200
219+
) {
220+
return false;
221+
}
222+
223+
if ($IPP->errorCode() == 401
224+
|| $IPP->errorCode() == 3200
225+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
226+
) {
227+
return false;
228+
}
229+
230+
if ($IPP->errorCode() == 401
231+
|| $IPP->errorCode()
232+
=== 'someverylongexpectedoutput'
233+
) {
234+
return false;
235+
}
236+
237+
if ($IPP->errorCode() == 401
238+
|| $IPP->errorCode()
239+
// A comment.
240+
=== 'someverylongexpectedoutput'
241+
) {
242+
return false;
243+
}
244+
245+
if ($IPP->errorCode() == 401
246+
|| $IPP->errorCode()
247+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
248+
=== 'someverylongexpectedoutput'
249+
) {
250+
return false;
251+
}

src/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.inc.fixed

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,63 @@ if ($a
185185
?>
186186
<?php endif; ?>
187187
<?php endforeach; ?>
188+
<?php
189+
190+
if ($IPP->errorCode() == 401 // phpcs:ignore Standard.Category.Sniff -- for reasons.
191+
|| $IPP->errorCode() == 3200 /*
192+
phpcs:ignore Standard.Category.Sniff -- for reasons.
193+
*/
194+
) {
195+
return false;
196+
}
197+
198+
if ($IPP->errorCode() == 401 // phpcs:disable Standard.Category.Sniff -- for reasons.
199+
|| $IPP->errorCode() == 3200 // phpcs:enable
200+
) {
201+
return false;
202+
}
203+
204+
if ($IPP->errorCode() == 401
205+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
206+
|| $IPP->errorCode() == 3200
207+
) {
208+
return false;
209+
}
210+
211+
if ($IPP->errorCode() == 401
212+
/*
213+
* phpcs:disable Standard.Category.Sniff -- for reasons.
214+
*/
215+
|| $IPP->errorCode() == 3200
216+
) {
217+
return false;
218+
}
219+
220+
if ($IPP->errorCode() == 401
221+
|| $IPP->errorCode() == 3200
222+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
223+
) {
224+
return false;
225+
}
226+
227+
if ($IPP->errorCode() == 401
228+
|| $IPP->errorCode() === 'someverylongexpectedoutput'
229+
) {
230+
return false;
231+
}
232+
233+
if ($IPP->errorCode() == 401
234+
|| $IPP->errorCode()
235+
// A comment.
236+
=== 'someverylongexpectedoutput'
237+
) {
238+
return false;
239+
}
240+
241+
if ($IPP->errorCode() == 401
242+
|| $IPP->errorCode()
243+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
244+
=== 'someverylongexpectedoutput'
245+
) {
246+
return false;
247+
}

src/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,75 @@ if (a
177177
)) {
178178
return false;
179179
}
180+
181+
182+
183+
184+
185+
186+
187+
188+
189+
190+
191+
192+
193+
if (foo == 401 || // phpcs:ignore Standard.Category.Sniff -- for reasons.
194+
bar == 3200) /*
195+
phpcs:ignore Standard.Category.Sniff -- for reasons.
196+
*/
197+
{
198+
return false;
199+
}
200+
201+
if (foo == 401 || // phpcs:disable Standard.Category.Sniff -- for reasons.
202+
bar == 3200) // phpcs:enable
203+
{
204+
return false;
205+
}
206+
207+
if (IPP.errorCode() == 401
208+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
209+
|| IPP.errorCode() == 3200
210+
) {
211+
return false;
212+
}
213+
214+
if (foo == 401 ||
215+
/*
216+
* phpcs:disable Standard.Category.Sniff -- for reasons.
217+
*/
218+
bar == 3200
219+
) {
220+
return false;
221+
}
222+
223+
if (IPP.errorCode() == 401
224+
|| IPP.errorCode() == 3200
225+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
226+
) {
227+
return false;
228+
}
229+
230+
if (foo == 401
231+
|| bar
232+
== 'someverylongexpectedoutput'
233+
) {
234+
return false;
235+
}
236+
237+
if (IPP.errorCode() == 401
238+
|| bar
239+
// A comment.
240+
== 'someverylongexpectedoutput'
241+
) {
242+
return false;
243+
}
244+
245+
if (foo == 401
246+
|| IPP.errorCode()
247+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
248+
== 'someverylongexpectedoutput'
249+
) {
250+
return false;
251+
}

src/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.js.fixed

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,74 @@ if (a
174174
) {
175175
return false;
176176
}
177+
178+
179+
180+
181+
182+
183+
184+
185+
186+
187+
188+
189+
190+
if (foo == 401 // phpcs:ignore Standard.Category.Sniff -- for reasons.
191+
|| bar == 3200 /*
192+
phpcs:ignore Standard.Category.Sniff -- for reasons.
193+
*/
194+
) {
195+
return false;
196+
}
197+
198+
if (foo == 401 // phpcs:disable Standard.Category.Sniff -- for reasons.
199+
|| bar == 3200 // phpcs:enable
200+
) {
201+
return false;
202+
}
203+
204+
if (IPP.errorCode() == 401
205+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
206+
|| IPP.errorCode() == 3200
207+
) {
208+
return false;
209+
}
210+
211+
if (foo == 401
212+
/*
213+
* phpcs:disable Standard.Category.Sniff -- for reasons.
214+
*/
215+
|| bar == 3200
216+
) {
217+
return false;
218+
}
219+
220+
if (IPP.errorCode() == 401
221+
|| IPP.errorCode() == 3200
222+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
223+
) {
224+
return false;
225+
}
226+
227+
if (foo == 401
228+
|| bar == 'someverylongexpectedoutput'
229+
) {
230+
return false;
231+
}
232+
233+
if (IPP.errorCode() == 401
234+
|| bar
235+
// A comment.
236+
== 'someverylongexpectedoutput'
237+
) {
238+
return false;
239+
}
240+
241+
if (foo == 401
242+
|| IPP.errorCode()
243+
// phpcs:ignore Standard.Category.Sniff -- for reasons.
244+
== 'someverylongexpectedoutput'
245+
) {
246+
return false;
247+
}

src/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public function getErrorList($testFile='MultiLineConditionUnitTest.inc')
5454
153 => 2,
5555
168 => 1,
5656
177 => 1,
57+
194 => 2,
58+
202 => 2,
59+
215 => 1,
60+
218 => 2,
61+
232 => 2,
62+
239 => 1,
63+
240 => 2,
64+
248 => 2,
5765
];
5866

5967
if ($testFile === 'MultiLineConditionUnitTest.inc') {

0 commit comments

Comments
 (0)