Welcome Guest, Not a member yet? Register   Sign In
Feature test http responses interfere between tests
#1

(This post was last modified: 09-07-2021, 11:08 AM by Taras.)

Hello
I am writing feature tests that access post and get endpoints.
PHP Code:
public function testAbc()
{
    $data = ['a' => 'a'];
    $response $this->post('abc'$data);
    $response->assertRedirect();
}

public function 
testDef()
{
    $response $this->get('def'$data);
    $response->assertNotRedirect();


Second assertion fails also controller does not have redirect. When I am dupming response value into console it looks sometimes fine or may contain previous response it some cases. It looks like response has data from the previous test for some reason. Why this happens? How it should be cleared?
Test class is defined like this:
PHP Code:
class MyFeatureTestCase extends CIUnitTestCase
{
    use DatabaseTestTraitFeatureTestTrait
Reply


Messages In This Thread
Feature test http responses interfere between tests - by Taras - 09-07-2021, 08:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB