-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic/EmptyPHPStatement: add tests for the short open tag
- Loading branch information
1 parent
586bf86
commit f6c5682
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.2.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Tests with short open tag. --> | ||
|
||
<input name="<? ; something_else(); ?>" /> | ||
<input name="<? something_else(); ; ?>" /> | ||
|
||
/* | ||
* Test empty statement: no code between PHP open and close tag. | ||
*/ | ||
<input name="<? something_else() ?>" /> <!-- OK. --> | ||
<input name="<? something_else(); ?>" /> <!-- OK. --> | ||
<input name="<? /* comment */ ?>" /> <!-- OK. --> | ||
|
||
<input name="<? ?>" /> <!-- Bad. --> | ||
|
||
<input name="<? | ||
|
||
|
||
?>" /> <!-- Bad. --> | ||
|
||
<!-- | ||
/* | ||
* Test detecting & fixing a combination of the two checks. | ||
*/ | ||
--> | ||
<? ; ?> | ||
|
||
<input name="<? ; ?>" /> <!-- Bad. --> |
23 changes: 23 additions & 0 deletions
23
src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.2.inc.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- Tests with short open tag. --> | ||
|
||
<input name="<?something_else(); ?>" /> | ||
<input name="<? something_else(); ?>" /> | ||
|
||
/* | ||
* Test empty statement: no code between PHP open and close tag. | ||
*/ | ||
<input name="<? something_else() ?>" /> <!-- OK. --> | ||
<input name="<? something_else(); ?>" /> <!-- OK. --> | ||
<input name="<? /* comment */ ?>" /> <!-- OK. --> | ||
|
||
<input name="" /> <!-- Bad. --> | ||
|
||
<input name="" /> <!-- Bad. --> | ||
|
||
<!-- | ||
/* | ||
* Test detecting & fixing a combination of the two checks. | ||
*/ | ||
--> | ||
|
||
<input name="" /> <!-- Bad. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters