Skip to content

Commit

Permalink
Don't close session after test
Browse files Browse the repository at this point in the history
Note to future self : While it looks like a good idea to close the session, it means the CI can't be reuse between test, as the session handler in the CI is still valid, the session is not, so it's not recreated.
  • Loading branch information
lcharette committed Mar 2, 2020
1 parent 5bdacbb commit 414fc92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
3 changes: 0 additions & 3 deletions app/sprinkles/account/tests/Integration/AuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function setUp()
// Setup test database
$this->setupTestDatabase();
$this->refreshDatabase();

// Force start session
$this->ci->session;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public function setUp()
parent::setUp();
$this->setupTestDatabase();

// Force start session
$this->ci->session;

if ($this->usingInMemoryDatabase() || !static::$initialized) {

// Setup database, then setup User & default role
Expand Down Expand Up @@ -502,11 +499,13 @@ public function testlogin(AccountController $controller)
$ms = $this->ci->alerts;
$messages = $ms->getAndClearMessages();
$this->assertSame('success', end($messages)['type']);

// We have to logout the user to avoid problem
$this->logoutCurrentUser($testUser);
}

/**
* @depends testControllerConstructor
* @depends testlogin
* @param AccountController $controller
*/
public function testloginWithEmail(AccountController $controller)
Expand Down Expand Up @@ -537,6 +536,9 @@ public function testloginWithEmail(AccountController $controller)
$ms = $this->ci->alerts;
$messages = $ms->getAndClearMessages();
$this->assertSame('success', end($messages)['type']);

// We have to logout the user to avoid problem
$this->logoutCurrentUser($testUser);
}

/**
Expand Down
5 changes: 0 additions & 5 deletions app/tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,8 @@ protected function tearDown()
call_user_func($callback);
}

// Force destroy test sessions
$this->ci->session->destroy();

// Close DB connection
$this->ci->db->getDatabaseManager()->disconnect();

$this->ci = null;
}

$this->setUpHasRun = false;
Expand Down

0 comments on commit 414fc92

Please sign in to comment.