Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require <?php tag in tests #9443

Merged
merged 1 commit into from Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/Traits/InvalidCodeAnalysisTestTrait.php
Expand Up @@ -51,6 +51,11 @@ public function testInvalidCode(
$this->markTestSkipped('Skipped due to a bug.');
}

// sanity check - do we have a PHP tag?
if (strpos($code, '<?php') === false) {
$this->fail('Test case must have a <?php tag');
}

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$code = str_replace("\n", "\r\n", $code);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Traits/ValidCodeAnalysisTestTrait.php
Expand Up @@ -55,6 +55,11 @@ public function testValidCode(
$this->markTestSkipped('Skipped due to a bug.');
}

// sanity check - do we have a PHP tag?
if (strpos($code, '<?php') === false) {
$this->fail('Test case must have a <?php tag');
}

foreach ($ignored_issues as $issue_name) {
Config::getInstance()->setCustomErrorLevel($issue_name, Config::REPORT_SUPPRESS);
}
Expand Down