Skip to content

Not work if mocked in test method and tests was run from phpunit command #32

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

Closed
KartaviK opened this issue Feb 14, 2019 · 1 comment
Closed

Comments

@KartaviK
Copy link

KartaviK commented Feb 14, 2019

Example code:

class MyTest extends \PHPUnit\Framework\TestCase
{
    public function testExample(): void
    {
        $microtime = $this->getFunctionMock("My\\Namespace", 'microtime');
        $microtime->expects($this->once())
            ->willReturn('123456');
    }
}

if i try run only this test with --filter - it will pass. But if i run all tests - it will crash.
If i remove this logic to setUp method - it will pass in any case.

@KartaviK
Copy link
Author

I understand that it is a bug that described in readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant