Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
app
Commits
8dd075c0
Commit
8dd075c0
authored
Oct 11, 2021
by
Bertrand Gauthier
Browse files
Suppression du SessionManagerFactory inutilisé car mal configuré.
parent
75e60fae
Pipeline
#11025
failed with stages
in 54 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
config/module.config.php
View file @
8dd075c0
...
...
@@ -281,8 +281,6 @@ return [
'factories'
=>
[
'translator'
=>
'Zend\I18n\Translator\TranslatorServiceFactory'
,
'navigation'
=>
'Zend\Navigation\Service\DefaultNavigationFactory'
,
// service de gestion de la session
'Zend\Session\SessionManager'
=>
'UnicaenApp\Session\SessionManagerFactory'
,
// service d'accès aux options de config de ce module
'unicaen-app_module_options'
=>
'UnicaenApp\Options\ModuleOptionsFactory'
,
// mapper d'accès aux individus de l'annuaire LDAP
...
...
src/UnicaenApp/Session/SessionManagerFactory.php
deleted
100644 → 0
View file @
75e60fae
<?php
namespace
UnicaenApp\Session
;
use
Interop\Container\ContainerInterface
;
use
UnicaenApp\Options\ModuleOptions
;
use
Zend\Session\Config\SessionConfig
;
use
Zend\Session\SessionManager
;
use
Zend\Session\Validator\HttpUserAgent
;
use
Zend\Session\Validator\RemoteAddr
;
/**
* Description of SessionManager
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/
class
SessionManagerFactory
{
public
function
__invoke
(
ContainerInterface
$container
)
{
/** @var ModuleOptions $moduleOptions */
$moduleOptions
=
$container
->
get
(
'unicaen-app_module_options'
);
$appInfos
=
$moduleOptions
->
getAppInfos
();
$sessionConfig
=
new
SessionConfig
();
$sessionConfig
->
setOptions
([
'name'
=>
md5
(
$appInfos
[
'nom'
]),
]);
$sessionManager
=
new
SessionManager
(
$sessionConfig
);
$chain
=
$sessionManager
->
getValidatorChain
();
$chain
->
attach
(
'session.validate'
,
array
(
new
RemoteAddr
(),
'isValid'
));
$chain
->
attach
(
'session.validate'
,
array
(
new
HttpUserAgent
(),
'isValid'
));
return
$sessionManager
;
}
}
\ No newline at end of file
tests/UnicaenAppTest/Session/SessionManagerFactoryTest.php
deleted
100644 → 0
View file @
75e60fae
<?php
namespace
UnicaenAppTest\Session
;
use
UnicaenApp\Options\ModuleOptions
;
use
UnicaenApp\Session\SessionManagerFactory
;
use
UnicaenAppTest\BaseServiceFactoryTest
;
use
Zend\Session\Container
;
use
Zend\Session\SessionManager
;
/**
* Description of ModuleOptionsFactoryTest
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/
class
ModuleOptionsFactoryTest
extends
BaseServiceFactoryTest
{
/**
* @var SessionManagerFactory
*/
protected
$factory
;
protected
$factoryClass
=
SessionManagerFactory
::
class
;
protected
$serviceClass
=
SessionManager
::
class
;
public
function
testCanCreateService
()
{
$appInfos
=
[
'nom'
=>
"Mon application"
,
];
$moduleOptions
=
$this
->
createMock
(
ModuleOptions
::
class
);
$moduleOptions
->
expects
(
$this
->
once
())
->
method
(
'getAppInfos'
)
->
willReturn
(
$appInfos
);
$this
->
serviceManager
->
expects
(
$this
->
once
())
->
method
(
'get'
)
->
with
(
'unicaen-app_module_options'
)
->
willReturn
(
$moduleOptions
);
$service
=
$this
->
factory
->
__invoke
(
$this
->
serviceManager
);
/* @var $service \Zend\Session\SessionManager */
$this
->
assertInstanceOf
(
$this
->
serviceClass
,
$service
);
$this
->
assertNotEmpty
(
$service
->
getValidatorChain
()
->
getListeners
(
'session.validate'
));
$this
->
assertEquals
(
$service
->
getConfig
()
->
getName
(),
md5
(
$appInfos
[
'nom'
]));
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment