Reputation: 9448
I have a simple PHPUnit/Symfony WebTestCase set up to test our site's login form.
$form = $crawler->filter("#register")->form();
// set form values
$crawler = $this->client->submit($form);
The form will submit to /register
, and then redirect to /registered
on success (and 200/OK back to /register
on failure).
If I use either $this->client->followRedirects();
before block above, or $this->client->followRedirect();
after the submit, I get a segfault. There's really no indication of where the segfault is taking place.
Something else of note: if I run JUST the tests in this tests parent class (2 tests) i.e. using --filter [THE CLASS]
it runs fine. If I try to run this test, along with the full suite (~15 tests), I get the segfault.
I've tried giving phpunit more memory using the -d
flag, but that doesn't really help.
Upvotes: 2
Views: 1146
Reputation: 39380
The problem can be in controller work in conjunction with other component.
I suggest you to use the Process Isolation in PHPUnit so you can run the critical test in a separate PHP process. As Example, you can use the following annotations for:
Indicates that all tests in a test class should be run in a separate PHP process:
/**
* @runTestsInSeparateProcesses
*/
class MyTest extends PHPUnit_Framework_TestCase
{
// ...
}
Indicates that a test should be run in a separate PHP process:
class MyTest extends PHPUnit_Framework_TestCase
{
/**
* @runInSeparateProcess
*/
public function testInSeparateProcess()
{
// ...
}
}
Hope this help
Upvotes: 1