Skip to content

Commit

Permalink
Rename hasExpectationOnOutput() to expectsOutput() and extract hasExp…
Browse files Browse the repository at this point in the history
…ectationOnOutput() from it
  • Loading branch information
sebastianbergmann committed Aug 3, 2023
1 parent db3c410 commit d3d14bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ final public function hasUnexpectedOutput(): bool
return false;
}

if ($this->hasExpectationOnOutput()) {
if ($this->expectsOutput()) {
return false;
}

Expand Down Expand Up @@ -598,9 +598,9 @@ final public function doesNotPerformAssertions(): bool
/**
* @internal This method is not covered by the backward compatibility promise for PHPUnit
*/
final public function hasExpectationOnOutput(): bool
final public function expectsOutput(): bool
{
return is_string($this->outputExpectedString) || is_string($this->outputExpectedRegex) || $this->outputRetrievedForAssertion;
return $this->hasExpectationOnOutput() || $this->outputRetrievedForAssertion;
}

/**
Expand Down Expand Up @@ -2184,6 +2184,14 @@ private function isRegisteredFailure(Throwable $t): bool
return false;
}

/**
* @internal This method is not covered by the backward compatibility promise for PHPUnit
*/
private function hasExpectationOnOutput(): bool
{
return is_string($this->outputExpectedString) || is_string($this->outputExpectedRegex);
}

/**
* Creates a test stub for the specified interface or class.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PHP/Template/TestCaseClass.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function __phpunit_run_isolated_test()

$output = '';

if (!$test->hasExpectationOnOutput()) {
if (!$test->expectsOutput()) {
$output = $test->output();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Util/PHP/Template/TestCaseMethod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function __phpunit_run_isolated_test()

$output = '';

if (!$test->hasExpectationOnOutput()) {
if (!$test->expectsOutput()) {
$output = $test->output();
}

Expand Down

0 comments on commit d3d14bf

Please sign in to comment.