Commit 01365166 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Nettoyage de code de test

parent 5a8a4671
Loading
Loading
Loading
Loading
+1 −24
Original line number Diff line number Diff line
@@ -4,10 +4,6 @@
 * UnicaenAuthentification Global Configuration
 */

use Application\View\Helper\TestConnectViewHelper;
use Application\View\Helper\TestConnectViewHelperFactory;
use Laminas\Authentication\Adapter\Ldap;
use UnicaenAuthentification\Form\LoginForm;

return [
    'unicaen-auth' =>  [
@@ -25,27 +21,8 @@ return [
//        'ldap_username' => 'uid',
//        'ldap_username' => 'supannaliaslogin',

        'auth_types' => [
            'local', // càd 'ldap' et 'db'
            'cas',
            'shib',
            'test',
    ],

        'test' => [
            'enabled' => false,
            //'adapter' => Ldap::class,
            'form' => LoginForm::class,
        ],
    ],
    'view_helpers' => [
        'aliases' => [
            'testConnect' => TestConnectViewHelper::class,
        ],
        'factories' => [
            TestConnectViewHelper::class => TestConnectViewHelperFactory::class,
        ],
    ],
];

+0 −32
Original line number Diff line number Diff line
<?php

namespace Application\View\Helper;

use Laminas\View\Renderer\PhpRenderer;
use UnicaenAuthentification\View\Helper\AbstractConnectViewHelper;

/**
 * Aide de vue dessinant le bouton de connexion via Shibboleth,
 * si l'authentification Shibboleth est activée.
 *
 * @method PhpRenderer getView()
 * @author Unicaen
 */
class TestConnectViewHelper extends AbstractConnectViewHelper
{
    const TYPE = 'test';
    const TITLE = "Mon onglet de test";

    public function __construct()
    {
        $this->setType(self::TYPE);
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return "test";
    }
}
 No newline at end of file
+0 −32
Original line number Diff line number Diff line
<?php

namespace Application\View\Helper;

use Interop\Container\ContainerInterface;
use UnicaenAuthentification\Options\ModuleOptions;
use UnicaenAuthentification\View\Helper\ShibConnectViewHelper;

class TestConnectViewHelperFactory
{
    /**
     * @param ContainerInterface $container
     * @return TestConnectViewHelper
     */
    public function __invoke(ContainerInterface $container)
    {
        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $container->get('unicaen-auth_module_options');
        $config = $moduleOptions->getShib();

        $enabled = isset($config['enabled']) && (bool) $config['enabled'];
        $title = $config['title'] ?? null;
        $description = $config['description'] ?? null;

        $helper = new TestConnectViewHelper();
        $helper->setEnabled($enabled);
        $helper->setTitle($title ?? TestConnectViewHelper::TITLE);
        $helper->setDescription($description);

        return $helper;
    }
}
 No newline at end of file