diff --git a/FEATURES/175476 b/FEATURES/175476 new file mode 100644 index 0000000000000000000000000000000000000000..784bbb21a017f3307e57f2bad8d3679a940feb56 --- /dev/null +++ b/FEATURES/175476 @@ -0,0 +1,10 @@ + '175476' => + ['Label' => $this->_('CAS2 C3RB et récupération des attributs'), + 'Desc' => '', + 'Image' => '', + 'Video' => '', + 'Category' => '', + 'Right' => function($feature_description, $user) {return true;}, + 'Wiki' => '', + 'Test' => '', + 'Date' => '2023-04-05'], \ No newline at end of file diff --git a/VERSIONS_WIP/175476 b/VERSIONS_WIP/175476 new file mode 100644 index 0000000000000000000000000000000000000000..f06e409d255d7963ecb3c1637fe139c73d934502 --- /dev/null +++ b/VERSIONS_WIP/175476 @@ -0,0 +1 @@ + - fonctionnalité #175476 : CAS2 C3RB et récupération des attributs \ No newline at end of file diff --git a/library/Class/IdentityProvider.php b/library/Class/IdentityProvider.php index 0b896fe7f085fb56ab40008d0e112cfb0ad33711..1cca3a614052f52f1768cdd21c4b336273cd7473 100644 --- a/library/Class/IdentityProvider.php +++ b/library/Class/IdentityProvider.php @@ -101,7 +101,8 @@ class Class_IdentityProvider extends Storm_Model_Abstract{ protected function _isCas() :bool { return ($this->getType() == Class_IdentityProvider_Types::CAS2) - || ($this->getType() == Class_IdentityProvider_Types::CAS3); + || ($this->getType() == Class_IdentityProvider_Types::CAS3) + || ($this->getType() == Class_IdentityProvider_Types::C3RB); } diff --git a/library/Class/IdentityProvider/C3rb.php b/library/Class/IdentityProvider/C3rb.php new file mode 100644 index 0000000000000000000000000000000000000000..c2818eb433eb4b9482519296d45c895c6a1b7bac --- /dev/null +++ b/library/Class/IdentityProvider/C3rb.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_IdentityProvider_C3rb extends Class_IdentityProvider_Default { + + protected $_service_class = Class_WebService_C3rb::class; + + + public function getType() { + return 'c3rb'; + } + + + public static function getMapping() : array { + return ['nom' => 'nom', + 'prenom' => 'prenom', + 'mail'=> 'mail', + 'naissance' => 'birth', + 'idabon' => 'cb']; + } +} diff --git a/library/Class/IdentityProvider/Types.php b/library/Class/IdentityProvider/Types.php index 57045e5604c297907174d4df6157398493a01eb0..32290557c567944946e38bd63db6f4ffe306bd18 100644 --- a/library/Class/IdentityProvider/Types.php +++ b/library/Class/IdentityProvider/Types.php @@ -29,7 +29,8 @@ class Class_IdentityProvider_Types { FRANCE_CONNECT = 'franceconnect', ACHETEZA = 'acheteza', CAS2 = 'cas2', - CAS3 = 'cas3'; + CAS3 = 'cas3', + C3RB = 'c3rb'; protected $_services; @@ -46,7 +47,8 @@ class Class_IdentityProvider_Types { static::FRANCE_CONNECT => $this->_('Franceconnect'), static::ACHETEZA => $this->_('Portail citoyen Acheteza.com'), static::CAS2 => $this->_('CAS 2.0'), - static::CAS3 => $this->_('CAS 3.0')]; + static::CAS3 => $this->_('CAS 3.0'), + static::C3RB => $this->_('C3rb')]; } diff --git a/library/Class/WebService/C3rb.php b/library/Class/WebService/C3rb.php new file mode 100644 index 0000000000000000000000000000000000000000..81666758d211cf059be0eb6cbf9871fa03aa55a8 --- /dev/null +++ b/library/Class/WebService/C3rb.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_WebService_C3rb extends Class_WebService_Cas2 { + + protected $_user_attributes = []; + + + protected function _mappingResponse(string $body) :self { + foreach (Class_IdentityProvider_C3rb::getMapping() as $function_name => $key) + $this->_user_attributes[$function_name] = $this->_getMappingValue($body, $key); + + return $this; + } + + + public function updateUser(Class_Users $user) : self { + foreach ($this->_user_attributes as $function_name => $value) + $user->callSetterByAttributeName($function_name, + $this->_validateValue($value, $function_name)); + return $this; + } + + + protected function _validateValue(?string $value, string $function_name) { + return (($function_name == 'naissance') && $value) + ? date('Y-m-d', strtotime($value)) + : $value; + } +} diff --git a/library/ZendAfi/Form/Admin/IdentityProvider.php b/library/ZendAfi/Form/Admin/IdentityProvider.php index 11ce0f2a8904aa2b5ab4cc4c4f3853b3d0ff836e..b13dcadd60d35b9c2667ec1cc455b4d23b787739 100644 --- a/library/ZendAfi/Form/Admin/IdentityProvider.php +++ b/library/ZendAfi/Form/Admin/IdentityProvider.php @@ -26,13 +26,13 @@ class ZendAfi_Form_Admin_IdentityProvider extends ZendAfi_Form { Class_ScriptLoader::getInstance() ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#button_logout, #logout_url").closest("tr"), ["default", "acheteza"]);') - ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#url").closest("tr"), ["cas2", "cas3", "default", "acheteza"]);') + ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#url").closest("tr"), ["cas2", "cas3", "default", "acheteza", "c3rb"]);') ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#disable_nonce_check").closest("tr"), ["default"]);') ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#prod_url").closest("tr"), ["franceconnect"]);') ->addJQueryBackEnd('checkBoxToggleVisibilityForElement("#auto_create_users", $("#id_site").closest("tr"), 1);') ->addJQueryBackEnd('checkBoxToggleVisibilityForElement("#auto_create_users", $("#role_level").closest("tr"), 1);') ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#client_id, #client_secret").closest("tr"), ["default", "google", "franceconnect", "acheteza"]);') - ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#associate_on_login, #auto_create_users, #auto_update_users").closest("tr"), ["default", "cas2", "cas3"]);') + ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#associate_on_login, #auto_create_users, #auto_update_users").closest("tr"), ["default", "cas2", "cas3", "c3rb"]);') ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#multi_inputs_scopes").closest("tr"), ["default"]);') ->addJQueryBackEnd('formSelectToggleVisibilityForElement("#type", $("#fieldset-mapping"), ["cas3"]);'); diff --git a/tests/scenarios/IdentityProvider/IdentityProviderAdminTest.php b/tests/scenarios/IdentityProvider/IdentityProviderAdminTest.php index 8e87e851c40b833ffc762c66f1bf199a56f0c306..788637432bd4f27856c03bdf727dea82f4ce53b2 100644 --- a/tests/scenarios/IdentityProvider/IdentityProviderAdminTest.php +++ b/tests/scenarios/IdentityProvider/IdentityProviderAdminTest.php @@ -173,6 +173,12 @@ class IdentityProviderAdminAddTest extends IdentityProviderAdminTestCase { } + /** @test */ + public function typeSelectShouldContainC3rbOption() { + $this->assertXPath('//select[@name="type"]/option[@value="c3rb"]'); + } + + /** @test */ public function typeSelectShouldContainLibraryOption() { $this->assertXPath('//select[@name="default_id_bib"]//option[@label="Bibliothèque Georges Brassens"]'); @@ -676,6 +682,262 @@ class IdentityProviderAdminEditCas3Test extends IdentityProviderAdminTestCase { +class IdentityProviderAdminPostAddC3rbTest extends IdentityProviderAdminTestCase { + protected $_provider; + + public function setUp() { + parent::setUp(); + + $this->fixture(Class_Bib::class, + ['id' => 3, + 'libelle' => 'Cran-Gévrier', + 'ville' => 'Cran-Gévrier', + 'url_web' => 'cran.com', + 'visibilite' => Class_Bib::V_DATA]); + + $this->postDispatch('/admin/identity-providers/add', + ['label' => 'Serveur C3rb', + 'active' => true, + 'type' => 'c3rb', + 'url' => 'https://www.c3rb-identities.fr', + 'associate_on_login' => true, + 'auto_create_users' => true, + 'auto_update_users' => true, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE, + 'default_id_bib' => 3, + 'redirect_to_preregistration' => false]); + + $this->_provider = Class_IdentityProvider::findFirstBy(['label' => 'Serveur C3rb']); + } + + + /** @test */ + public function providerShouldBeNotnull() { + $this->assertNotNull($this->_provider); + } + + + /** @test */ + public function providerLabelShouldBeSevrveurC3rb() { + $this->assertEquals($this->_provider->getLabel(), 'Serveur C3rb'); + } + + + /** @test */ + public function providerShouldBeActive() { + $this->assertEquals($this->_provider->getActive(), 1); + } + + + /** @test */ + public function providerTypeShouldBeC3rb(){ + $this->assertEquals($this->_provider->getType(), 'c3rb'); + } + + + /** @test */ + public function providerUrlShouldBeC3rbIdentitesDotFr() { + $this->assertEquals($this->_provider->getUrl(), 'https://www.c3rb-identities.fr'); + } + + + /** @test */ + public function providerShouldAssociateOnLogin() { + $this->assertEquals($this->_provider->getAssociateOnLogin(), 1); + } + + + /** @test */ + public function providerShouldCreateUsers() { + $this->assertEquals($this->_provider->getAutoCreateUsers(), 1); + } + + + /** @test */ + public function providerShouldUpdateUsers(){ + $this->assertEquals($this->_provider->getAutoUpdateUsers(), '1'); + } + + + /** @test */ + public function providerRoleLevelShouldBeAbonne(){ + $this->assertEquals($this->_provider->getRoleLevel(), ZendAfi_Acl_AdminControllerRoles::ABONNE); + } + + + /** @test */ + public function providerIbBibShouldBe3() { + $this->assertEquals($this->_provider->getDefaultIdBib(), 3); + } + + + /** @test */ + public function providerShouldNotRedirectToPreregistration() { + $this->assertEquals($this->_provider->getRedirectToPreregistration(), ''); + } +} + + + + +class IdentityProviderAdminPostEditC3rbTest extends IdentityProviderAdminTestCase { + protected $_provider; + + public function setUp() { + parent::setUp(); + + $this->fixture(Class_Bib::class, + ['id' => 2, + 'libelle' => 'Cran-Gévrier', + 'ville' => 'Cran-Gévrier', + 'url_web' => 'cran.com', + 'visibilite' => Class_Bib::V_DATA]); + + $this->fixture(Class_IdentityProvider::class, + ['id' => 2, + 'label' => 'Serveur C3rb', + 'type' => 'c3rb', + 'active' => 1]); + + $this->postDispatch('/admin/identity-providers/edit/id/2', + ['label' => 'Serveur C3rb edited', + 'active' => true, + 'type' => 'c3rb', + 'url' => 'https://www.c3rb-identities.fr/login', + 'associate_on_login' => false, + 'auto_create_users' => false, + 'auto_update_users' => false, + 'default_id_bib' => 2, + 'redirect_to_preregistration' => false]); + + $this->_provider = Class_IdentityProvider::find(2); + } + + + /** @test */ + public function providerShouldBeNotnull() { + $this->assertNotNull($this->_provider); + } + + + /** @test */ + public function providerLabelShouldBeSevrveurC3rb() { + $this->assertEquals($this->_provider->getLabel(), 'Serveur C3rb edited'); + } + + + /** @test */ + public function providerShouldBeActive() { + $this->assertEquals($this->_provider->getActive(), 1); + } + + + /** @test */ + public function providerTypeShouldBeC3rb(){ + $this->assertEquals($this->_provider->getType(), 'c3rb'); + } + + + /** @test */ + public function providerUrlShouldBeC3rbIdentitesDotFr() { + $this->assertEquals($this->_provider->getUrl(), 'https://www.c3rb-identities.fr/login'); + } + + + /** @test */ + public function providerShouldAssociateOnLogin() { + $this->assertEquals($this->_provider->getAssociateOnLogin(), ''); + } + + + /** @test */ + public function providerShouldCreateUsers() { + $this->assertEquals($this->_provider->getAutoCreateUsers(), ''); + } + + + /** @test */ + public function providerShouldUpdateUsers(){ + $this->assertEquals($this->_provider->getAutoUpdateUsers(), ''); + } + + + /** @test */ + public function providerRoleLevelShouldBeAbonne(){ + $this->assertEquals($this->_provider->getRoleLevel(), ''); + } + + + /** @test */ + public function providerIbBibShouldBe3() { + $this->assertEquals($this->_provider->getDefaultIdBib(), 2); + } + + + /** @test */ + public function providerShouldNotRedirectToPreregistration() { + $this->assertEquals($this->_provider->getRedirectToPreregistration(), ''); + } +} + + + + +class IdentityProviderAdminEditC3rbTest extends IdentityProviderAdminTestCase { + + public function setUp() { + parent::setUp(); + + $this->fixture(Class_Bib::class, + ['id' => 3, + 'libelle' => 'Cran-Gévrier', + 'ville' => 'Cran-Gévrier', + 'url_web' => 'cran.com', + 'visibilite' => Class_Bib::V_DATA]); + + $provider = $this->fixture(Class_IdentityProvider::class, + ['id' => 2, + 'label' => 'Serveur C3rb', + 'type' => 'c3rb', + 'active' => 1, + 'config' => json_encode(['url' => 'https://backend-c3rb.org', + 'default_id_bib' => 3, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE, + 'auto_create_users' => 1, + 'auto_update_users' => 1]) + ]); + + $this->dispatch('/admin/identity-providers/edit/id/2'); + } + + + /** @test */ + public function providerTypeShouldBeCAS3() { + $this->assertXPath('//select[@name="type"]/option[@value="c3rb"][@selected="selected"]'); + } + + + /** @test */ + public function providerRoleLevelShouldBeAbonne() { + $this->assertXPath('//select[@name="role_level"]/option[@value="' . ZendAfi_Acl_AdminControllerRoles::ABONNE . '"][@selected="selected"]'); + } + + + /** @test */ + public function providerAutoUpdateUsersShouldBeChecked() { + $this->assertXPath('//input[@type="checkbox"][@name="auto_update_users"][@value="1"][@checked="checked"]'); + } + + + /** @test */ + public function providerIdSiteShouldBe3() { + $this->assertXPath('//select[@name="default_id_bib"]/option[@value="3"][@selected="selected"]'); + } +} + + + + class IdentityProviderAdminWidgetTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); diff --git a/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationC3rbTest.php b/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationC3rbTest.php new file mode 100644 index 0000000000000000000000000000000000000000..98ac86de10123873de8fa011d882827df8409546 --- /dev/null +++ b/tests/scenarios/IdentityProvider/IdentityProviderAuthenticationC3rbTest.php @@ -0,0 +1,258 @@ +<?php +/** + * Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +abstract class IdentityProviderAuthenticationC3rbTestCase extends AbstractControllerTestCase { + + protected $_provider; + + + public function setUp() { + parent::setUp(); + Class_AdminVar::set('ENABLE_IDENTITY_PROVIDERS', 1); + + $this->_provider = $this->fixture(Class_IdentityProvider::class, + ['id' => 1, + 'label' => 'Serveur C3rb', + 'type' => 'c3rb', + 'config' => json_encode($this->_identityProviderConfig())]); + } + + + protected function _identityProviderConfig(){ + return ['url' => 'http://cas.c3rb.com/', + 'auto_create_users' => 1, + 'auto_update_users' => 1, + 'associate_on_login' => 1, + 'role_level'=> ZendAfi_Acl_AdminControllerRoles::ABONNE, + 'default_id_bib' => 3]; + } + + + public function tearDown() { + Class_WebService_Cas2::setWebClient(null); + Class_WebService_Cas2::clearSession(); + parent::tearDown(); + } +} + + + + +class IdentityProviderAuthenticationC3rbInvalidTicketNotLoggedNotAssociatedTest + extends IdentityProviderAuthenticationC3rbTestCase { + + public function setUp() { + parent::setUp(); + ZendAfi_Auth::getInstance()->clearIdentity(); + Class_WebService_C3rb::loginWith('me'); + + $response = $this->mock() + ->whenCalled('isError')->answers(false) + + ->whenCalled('getBody') + ->answers('<cas:serviceResponse xmlns:cas=’http://www.yale.edu/tp/cas’> + <cas:authenticationFailure code="INVALID_TICKET"> + Ticket testticket not recognized + </cas:authenticationFailure> +</cas:serviceResponse>'); + + Class_WebService_C3rb::setWebClient($this->mock() + ->whenCalled('getResponse') + ->answers($response)); + + $this->dispatch('/auth/login/provider/1?ticket=testticket'); + } + + + /** @test */ + public function providerShouldNotBeRemotelyLogged() { + $this->assertFalse($this->_provider->isRemotelyLogged()); + } +} + + + + +class IdentityProviderAuthenticationC3rbToBokehTestCase + extends IdentityProviderAuthenticationC3rbTestCase{ + + public function setUp() { + parent::setUp(); + ZendAfi_Auth::getInstance()->clearIdentity(); + Class_WebService_C3rb::loginWith('myawesomeuser'); + + $response = $this->mock() + ->whenCalled('isError')->answers(false) + + ->whenCalled('getBody') + ->answers('<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas"> + <cas:authenticationSuccess> + <cas:attributes> + <cas:user>myawesomeuser</cas:user> + <cas:mail>awesome@user.fr</cas:mail> + <cas:birth>01/01/2001</cas:birth> + <cas:nom>Awesome</cas:nom> + <cas:prenom>My</cas:prenom> + <cas:cb>T1</cas:cb> + </cas:attributes> + </cas:authenticationSuccess> +</cas:serviceResponse>'); + + Class_WebService_C3rb::setWebClient($this->mock() + ->whenCalled('getResponse') + ->answers($response)); + + $this->dispatch('/auth/login/provider/1?ticket=testticket'); + } + + + /** @test */ + public function userShouldLoggedIn() { + $this->assertNotNull(Class_Users::getIdentity()); + } + + + /** @test */ + public function userShouldBeRemotelyLogged() { + $this->assertTrue($this->_provider->isRemotelyLogged()); + } + + + /** @test */ + public function myAwesomeUserShouldBeCreated() { + $this->assertNotNull(Class_Users::findFirstBy(['login' => 'myawesomeuser'])); + } + + + /** @test */ + public function userNameShouldBeAwesome() { + $this->assertEquals('Awesome', Class_Users::getIdentity()->getNom()); + } + + + /** @test */ + public function userFirstnameShouldBeMy() { + $this->assertEquals('My', Class_Users::getIdentity()->getPrenom()); + } + + + /** @test */ + public function userMailShouldBeAwesomeAtUserDotFr() { + $this->assertEquals('awesome@user.fr', Class_Users::getIdentity()->getMail()); + } + + + /** @test */ + public function userBirthShouldBe20010101() { + $this->assertEquals('2001-01-01', Class_Users::getIdentity()->getNaissance()); + } + + + /** @test */ + public function userIdAbonShouldBeT1() { + $this->assertEquals('T1', Class_Users::getIdentity()->getIdabon()); + } + + + /** @test */ + public function userSiteShouldBeThree() { + $this->assertEquals(3, Class_Users::getIdentity()->getIdSite()); + } + + + /** @test */ + public function userRoleLevelShouldBeOne() { + $this->assertEquals(1, Class_Users::getIdentity()->getRoleLevel()); + } +} + + + + +class IdentityProviderAuthenticationC3rbToBokehUpdateTestCase + extends IdentityProviderAuthenticationC3rbTestCase{ + + public function setUp() { + parent::setUp(); + ZendAfi_Auth::getInstance()->clearIdentity(); + Class_WebService_C3rb::loginWith('myawesomeuser'); + + $response = $this->mock() + ->whenCalled('isError')->answers(false) + + ->whenCalled('getBody') + ->answers('<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas"> + <cas:authenticationSuccess> + <cas:attributes> + <cas:user>myawesomeuser</cas:user> + <cas:mail>awesome@user.fr</cas:mail> + <cas:birth></cas:birth> + <cas:nom>Awesome</cas:nom> + <cas:prenom>MyEdited</cas:prenom> + <cas:cb>T1</cas:cb> + </cas:attributes> + </cas:authenticationSuccess> +</cas:serviceResponse>'); + + Class_WebService_C3rb::setWebClient($this->mock() + ->whenCalled('getResponse') + ->answers($response)); + + $this->fixture(Class_Users::class, + ['id' => 2, + 'login' => 'myawesomeuser', + 'password' => 'password', + 'nom' => 'Awesome', + 'prenom' => 'My', + 'mail' => 'awesome@user.fr', + 'naissance' => '2001-01-01', + 'id_abon' => 'T1', + 'role_level' => 1]); + + $this->fixture(Class_User_Identity::class, + ['id' => 1, + 'provider_id' => 1, + 'user_id' => 2, + 'identifier' => 'myawesomeuser']); + + $this->dispatch('/auth/login/provider/1?ticket=testticket'); + } + + + /** @test */ + public function userShouldLoggedIn() { + $this->assertNotNull(Class_Users::getIdentity()); + } + + + /** @test */ + public function userFirstnameShouldBeMyEdited() { + $this->assertEquals('MyEdited', Class_Users::getIdentity()->getPrenom()); + } + + + /** @test */ + public function userBirthShouldBeEmpty() { + $this->assertEquals('', Class_Users::getIdentity()->getNaissance()); + } + +}