Add integration tests [MAILPOET-2015]

This commit is contained in:
wxa
2019-07-04 20:20:06 +03:00
committed by M. Shull
parent b174a55d07
commit d36c9b44e4
6 changed files with 161 additions and 4 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace MailPoet\Test\Config;
use MailPoet\Config\Session;
class SessionTest extends \MailPoetTest {
function _before() {
$this->destroySessionIfExists();
}
function testItStartsSessionIfItIsNotStarted() {
expect(session_id())->isEmpty();
$session = new Session;
$result = $session->init();
expect($result)->equals(true);
expect(session_id())->notEmpty();
session_destroy();
}
function testItDoesNotStartSessionIfItIsAlreadyStarted() {
session_start();
expect(session_id())->notEmpty();
$session = new Session;
$result = $session->init();
expect($result)->equals(false);
expect(session_id())->notEmpty();
session_destroy();
}
private function destroySessionIfExists() {
if (session_id()) {
session_destroy();
}
}
}