Adding some (PHP) unit tests related to automatic creation of a session

parent d3c5ca21
Pipeline #238 failed with stage
in 25 seconds
......@@ -93,4 +93,88 @@ final class SessionCapturedConfigurationPropertyUtilsTest
'/tmp'
);
}
public function
testGetCreateAutomaticallyFromMapWithoutSection()
{
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapWithoutSection(array()),
''
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapWithoutSection(
array('session-create-auto' => 'false')
),
'false'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapWithoutSection(
array('session-create-auto' => 'no')
),
'no'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapWithoutSection(
array('session-create-auto' => 'true')
),
'true'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapWithoutSection(
array('session-create-auto' => 'yes')
),
'yes'
);
}
public function
testGetCreateAutomaticallyFromMapInSection()
{
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapInSection(array()),
''
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapInSection(
array('create-auto' => 'false')
),
'false'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapInSection(
array('create-auto' => 'no')
),
'no'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapInSection(
array('create-auto' => 'true')
),
'true'
);
$this->assertEquals(
SessionCapturedConfigurationPropertyUtils::
getCreateAutomaticallyFromMapInSection(
array('create-auto' => 'yes')
),
'yes'
);
}
}
......@@ -86,6 +86,80 @@ final class SessionCapturedConfigurationUtilsNoHttpTest
$this->assertTrue($configuration->hasToSave()->isFalse());
}
public function
testCreateFromMapAndCheckCreateAutomatically()
{
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array()
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isUndefined()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => '')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isUndefined()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'true')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isTrue()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'yes')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isTrue()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'on')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isTrue()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'false')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isFalse()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'no')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isFalse()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-create-auto' => 'off')
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isFalse()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-captured' => array('create-auto' => 'on'))
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isTrue()
);
$configuration = SessionCapturedConfigurationUtils::createFromMap(
array('session-captured' => array('create-auto' => 'off'))
);
$this->assertTrue(
$configuration->hasToCreateAutomatically()->isFalse()
);
}
public function
testCreateFromMapAndCheckDirectory()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment