Session class update, cli check add, tests updates, edit table update
Update edit_access_data table and set unique check for edit_access_id + name so we do not have two identical keys for one edit access set Update config host and add more test domains for various access tests Update Session and move cli check to Get\System class. Some other minor session info updates New method \Get\System::checkCLI() returns true if the sapi name has cli inside, else false
This commit is contained in:
@@ -20,6 +20,10 @@ final class CoreLibsCreateSessionTest extends TestCase
|
||||
*/
|
||||
public function sessionProvider(): array
|
||||
{
|
||||
// 0: session name as parameter
|
||||
// 1: type p (param), g: global, c: constant
|
||||
// 2: exepcted name (session)
|
||||
// 3: regex check
|
||||
return [
|
||||
'session parameter' => [
|
||||
'sessionNameParameter',
|
||||
@@ -42,23 +46,11 @@ final class CoreLibsCreateSessionTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
if (session_id()) {
|
||||
session_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @dataProvider sessionProvider
|
||||
* @testdox startSession $input name for $type will be $expected_n with $expected_i [$_dataName]
|
||||
* @testdox startSession $input name for $type will be $expected_n with $expected_i [$_dataName]
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $type
|
||||
@@ -66,8 +58,12 @@ final class CoreLibsCreateSessionTest extends TestCase
|
||||
* @param string|bool $expected_i
|
||||
* @return void
|
||||
*/
|
||||
public function testStartSession(string $input, string $type, $expected_n, $expected_i): void
|
||||
{
|
||||
public function testStartSession(
|
||||
string $input,
|
||||
string $type,
|
||||
$expected_n,
|
||||
$expected_i
|
||||
): void {
|
||||
// NEEDS MOCKING
|
||||
/* $session_id = '';
|
||||
switch ($type) {
|
||||
@@ -101,6 +97,64 @@ final class CoreLibsCreateSessionTest extends TestCase
|
||||
$this->markTestSkipped('[CoreLibsCreateSessionTest] No implementation '
|
||||
. 'for Create\Session. Cannot run session_start in CLI');
|
||||
}
|
||||
|
||||
/**
|
||||
* provider for session name check
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sessionNameProvider(): array
|
||||
{
|
||||
// 0: string for session
|
||||
// 1: expected return
|
||||
return [
|
||||
'valid name' => [
|
||||
'abc',
|
||||
true
|
||||
],
|
||||
'valid name longer' => [
|
||||
'something-abc-123',
|
||||
true
|
||||
],
|
||||
'invalid name' => [
|
||||
'abc#abc',
|
||||
false
|
||||
],
|
||||
'only numbers' => [
|
||||
'123',
|
||||
false
|
||||
],
|
||||
'longer than 128 chars' => [
|
||||
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
|
||||
. 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
|
||||
. 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz',
|
||||
false
|
||||
],
|
||||
'too short' => [
|
||||
'',
|
||||
false
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers ::checkValidSessionName
|
||||
* @dataProvider sessionNameProvider
|
||||
* @testdox checkValidSessionName $input seessionn name is $expected [$_dataName]
|
||||
*
|
||||
* @param string $input
|
||||
* @param bool $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testCheckValidSessionName(string $input, bool $expected): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
\CoreLibs\Create\Session::checkValidSessionName($input)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
|
||||
Reference in New Issue
Block a user