-
-
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.
Merge pull request #699 from rodrigoprimo/test-coverage-empty-php-sta…
…tement Generic/EmptyPHPStatement: improve code coverage
- Loading branch information
Showing
6 changed files
with
117 additions
and
39 deletions.
There are no files selected for viewing
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
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
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
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