Skip to content

Commit 38a90c1

Browse files
committed
Squiz/EmbeddedPhp: prevent tests being skipped
The sniff contains a condition which prevents checks from being run on the last tag set when it is a non-single line tag set. Adding a final open tag will prevent the _last_ test in the file accidentally being skipped, independently of what type of tag set this is, making the test case file more stable.
1 parent 16f4a3a commit 38a90c1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,8 @@ function foo()
119119
<?php echo 'okay'; // phpcs:ignore Standard.Category.Sniff -- reason. ?>
120120
<?php echo 'too much space before close'; // phpcs:ignore Standard.Category.Sniff -- reason. ?>
121121
<?php echo 'no space before close'; // phpcs:ignore Standard.Category.Sniff -- reason.?>
122+
123+
<?php
124+
// This test case file MUST always end with an unclosed long open PHP tag (with this comment) to prevent
125+
// the tests running into the "last PHP closing tag excepted" condition breaking tests.
126+
// Tests related to that "last PHP closing tag excepted" condition should go in separate files.

src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,8 @@ function foo()
119119
<?php echo 'okay'; // phpcs:ignore Standard.Category.Sniff -- reason. ?>
120120
<?php echo 'too much space before close'; // phpcs:ignore Standard.Category.Sniff -- reason. ?>
121121
<?php echo 'no space before close'; // phpcs:ignore Standard.Category.Sniff -- reason. ?>
122+
123+
<?php
124+
// This test case file MUST always end with an unclosed long open PHP tag (with this comment) to prevent
125+
// the tests running into the "last PHP closing tag excepted" condition breaking tests.
126+
// Tests related to that "last PHP closing tag excepted" condition should go in separate files.

0 commit comments

Comments
 (0)