Last active
January 20, 2017 00:51
-
-
Save cweagans/48711a05bce931075eff to your computer and use it in GitHub Desktop.
Changes undesirable behavior in PHPUnit_Extensions_PhptTestCase for cweagans/mcrypt-polyfill tests.
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
diff --git a/src/Extensions/PhptTestCase.php b/src/Extensions/PhptTestCase.php | |
index 162c6d80..cb1cfe02 100644 | |
--- a/src/Extensions/PhptTestCase.php | |
+++ b/src/Extensions/PhptTestCase.php | |
@@ -109,6 +109,10 @@ private function assertPhptExpectation(array $sections, $output) | |
$assertion = $sectionAssertion; | |
$expected = $sectionName == 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent; | |
+ // HACK: Get rid of filenames in expected output. | |
+ $expected = str_replace('%s%e' . basename($this->filename, 't'), '-', $expected); | |
+ $expected = str_replace('%s' . basename($this->filename, 't'), '-', $expected); | |
+ | |
break; | |
} | |
} | |
@@ -139,6 +143,9 @@ public function run(PHPUnit_Framework_TestResult $result = null) | |
$result->startTest($this); | |
+ // HACK: Load the test bootstrap file in every test. | |
+ $sections['INI'] = "auto_prepend_file='./vendor/autoload.php'"; | |
+ | |
if (isset($sections['INI'])) { | |
$settings = array_merge($settings, $this->parseIniSection($sections['INI'])); | |
} | |
@@ -155,22 +162,6 @@ public function run(PHPUnit_Framework_TestResult $result = null) | |
$this->phpUtil->setTimeout($result->getTimeoutForLargeTests()); | |
} | |
- if (isset($sections['SKIPIF'])) { | |
- $jobResult = $this->phpUtil->runJob($sections['SKIPIF'], $settings); | |
- | |
- if (!strncasecmp('skip', ltrim($jobResult['stdout']), 4)) { | |
- if (preg_match('/^\s*skip\s*(.+)\s*/i', $jobResult['stdout'], $message)) { | |
- $message = substr($message[1], 2); | |
- } else { | |
- $message = ''; | |
- } | |
- | |
- $result->addFailure($this, new PHPUnit_Framework_SkippedTestError($message), 0); | |
- | |
- $skip = true; | |
- } | |
- } | |
- | |
if (isset($sections['XFAIL'])) { | |
$xfail = trim($sections['XFAIL']); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment