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

mb_strpos(): Empty delimiter #2520

Closed
maveius opened this issue Feb 20, 2017 · 1 comment
Closed

mb_strpos(): Empty delimiter #2520

maveius opened this issue Feb 20, 2017 · 1 comment
Labels
type/bug Something is broken

Comments

@maveius
Copy link

maveius commented Feb 20, 2017

Error:

PHPUnit 6.0.7 by Sebastian Bergmann and contributors.


mb_strpos(): Empty delimiter
.../vendor/phpunit/phpunit/src/Framework/Constraint/StringContains.php:58 // this line added manualy because error handler catch this and after run debug mode then show line number and correct class
.../vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php:73
.../tests/AppBundle/Controller/LoginControllerTest.php:25
 


Time: 108 ms, Memory: 14.00MB


ERRORS!
Tests: 1, Assertions: 2, Errors: 1.

Process finished with exit code 2

My example test:

public function testIndex()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/');

        static::assertEquals(200, $client->getResponse()->getStatusCode());
        static::assertContains('', $crawler->filter('body')->text());
    }

I think assertContains should return true if expected (needle) value is the same as (haystack) or if some one check if empty string contains another empty string.

Visualized problem:

static::assertContains('', '');

or if someone would like to use assertContains for comparing two empty strings, maybe library inform that is not good way - I don't now. Like "assertContains is not for comparing to empty strings!... Please use assertEquals"? - I don't now. I'm not a specialist in XUnit philosophy. Now I fix this by change my testcase. But it is temporary solution.

@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.

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

Successfully merging a pull request may close this issue.

2 participants