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

test results of two methods in one test case may get mixed up #63

Closed
paranoiq opened this issue Dec 8, 2013 · 6 comments
Closed

test results of two methods in one test case may get mixed up #63

paranoiq opened this issue Dec 8, 2013 · 6 comments
Labels

Comments

@paranoiq
Copy link

paranoiq commented Dec 8, 2013

class SomeTest extends TestCase
{
    public function testAaa()
    {
        Assert::same(2, 2);
    }

    public function testBbb()
    {
        Assert::same(3, []);
    }
}

both fail with error array() should be 3 in testBbb()

only when runned with test runner, not directly

the reason is, that both test methods produce expected and actual files with the same name

@dg
Copy link
Member

dg commented Dec 11, 2013

How do you run TestCase?

@fprochazka
Copy link
Contributor

only when runned with test runner

He probably wasn't accepting the test method cli argument so the test case had been ran twice (because there are two methods) and in both cases, the test case ran both methods, so every time it ended with failure.

(new SomeTest)->run();

vs

(new SomeTest)->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);

@paranoiq
Copy link
Author

@dg this way:

$testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);

but there could be something on the "test case ran both methods" thing, because i saw some testing data leaking from one method to another. and they should be isolated. i'll check it again

@milo
Copy link
Member

milo commented Jan 10, 2014

@paranoiq I guess this happend when test was annoted by @testcase and you called $testCase->run() (or $_SERVER['argv'] was not set).

With current master, I cannot reproduce it by any combination. Could you try it again?

@paranoiq
Copy link
Author

ok, i am obviously an idiot. when i tried it again i finally find out what the problem was. i have disabled register_argc_argv directive in my testing php.ini

@milo
Copy link
Member

milo commented Jan 12, 2014

@paranoiq It has been fixed. Moreover, now you can forgot on it and run TestCase just by $testCase->run(). Tester handles it internally.

@milo milo closed this as completed Jan 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants