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

Uncaught TypeError: Return value of PHPUnit\Framework\TestCase::getActualOutput() must be of the type string, null returned #3014

Closed
thedotedge opened this issue Feb 16, 2018 · 5 comments
Labels
type/bug Something is broken

Comments

@thedotedge
Copy link

Q A
PHPUnit version 7.0.1
PHP version 7.1.4
Installation Method phar

Steps to reproduce:

  1. Add $this->withoutOutput(); to setUp().
Fatal error: Uncaught TypeError: Return value of PHPUnit\Framework\TestCase::getActualOutput() must be of the type string, null returned in phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestCase.php on line 415

TypeError: Return value of PHPUnit\Framework\TestCase::getActualOutput() must be of the type string, null returned in phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestCase.php on line 415

Call Stack:
    0.0322     821904   1. {main}() /usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar:0
    0.0832    8425664   2. PHPUnit\TextUI\Command::main() /usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar:573
    0.0832    8425776   3. PHPUnit\TextUI\Command->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/TextUI/Command.php:153
    0.8894   12929976   4. PHPUnit\TextUI\TestRunner->doRun() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/TextUI/Command.php:205
    0.8938   12934072   5. PHPUnit\Framework\TestSuite->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/TextUI/TestRunner.php:508
    0.8960   12934264   6. PHPUnit\Framework\TestSuite->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestSuite.php:761
    1.6258   18208744   7. PHPUnit\Framework\TestSuite->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestSuite.php:761
    1.6298   18208936   8. PHPUnit\Framework\TestCase->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestSuite.php:761
    1.6298   18208936   9. PHPUnit\Framework\TestResult->run() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestCase.php:687
    1.6676   18443144  10. PHPUnit\Framework\TestResult->endTest() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestResult.php:907
    1.6676   18443144  11. PHPUnit\TextUI\ResultPrinter->endTest() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/Framework/TestResult.php:410
    1.6676   18443144  12. PHPUnit\Framework\TestCase->getActualOutput() phar:///usr/local/Cellar/phpunit/7.0.1/libexec/phpunit-7.0.1.phar/phpunit/TextUI/ResultPrinter.php:352
@sebastianbergmann
Copy link
Owner

A method TestCase::withoutOutput() is not part of PHPUnit, so your reproduce step makes no sense to me.

@sebastianbergmann sebastianbergmann added type/bug Something is broken waiting-for-reproducing-example status/waiting-for-feedback Waiting for feedback from original reporter labels Feb 17, 2018
@sebastianbergmann
Copy link
Owner

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

@thedotedge
Copy link
Author

thedotedge commented Feb 17, 2018

Sure thing:

<?php

class CacheProviderTest extends \PHPUnit\Framework\TestCase {

    protected function setUp() {
        $this->setOutputCallback(function() {});
    }

    /** @test */
    public function it_can_clear_all_data() {
        \PHPUnit\Framework\Assert::assertSame('value', 'value');
    }
}

@sebastianbergmann
Copy link
Owner

The example in #3014 (comment) is not self-contained.

@thedotedge
Copy link
Author

Apologies, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants