diff --git a/VERSIONS_WIP/180706 b/VERSIONS_WIP/180706 new file mode 100644 index 0000000000000000000000000000000000000000..38d14b82ecf565c2db62cb5abf82bc19b4cf432e --- /dev/null +++ b/VERSIONS_WIP/180706 @@ -0,0 +1 @@ + - fonctionnalité #180706 : PNB : DRM LCP : Le mot de passe devient le login à la place de l'identifiant abonné pour les SIGB Orphée. \ No newline at end of file diff --git a/library/Class/WebService/BibNumerique/Dilicom/Hub.php b/library/Class/WebService/BibNumerique/Dilicom/Hub.php index 79899bf18a5e3700e19a3c690b0c4629731d260d..940e2a2e644d5da87a8ff1d2fa26a94b82292075 100644 --- a/library/Class/WebService/BibNumerique/Dilicom/Hub.php +++ b/library/Class/WebService/BibNumerique/Dilicom/Hub.php @@ -220,17 +220,24 @@ class Class_WebService_BibNumerique_Dilicom_Hub extends Class_WebService_Abstrac } - protected function _getReaderId($user) { - return $user->isAbonne() - ? $user->getIdabon() - : $user->getLogin(); + protected function _getReaderId(Class_Users $user) { + return $this->_shouldDisplayLoginAsPassword($user) + ? $user->getLogin() + : $user->getIdabon(); } - protected function _getReaderHint($user) { - return $user->isAbonne() - ? $this->_('Merci de saisir votre numero de carte') - : $this->_('Merci de saisir votre identifiant de connexion renseigné lors de votre inscription'); + protected function _shouldDisplayLoginAsPassword(Class_Users $user) : string{ + return (! $user->isAbonne()) + || (($library = $user->getIntBib()) + && $library->isOrphee()); + } + + + protected function _getReaderHint(Class_Users $user) : string{ + return $this->_shouldDisplayLoginAsPassword($user) + ? $this->_('Merci de saisir votre identifiant de connexion renseigné lors de votre inscription') + : $this->_('Merci de saisir votre numero de carte'); } diff --git a/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php b/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php index 956c7d3500e6ff7d375fb356b02de2d0fcec88df..0882e12432636f8cb6865e2f20f808e75414e26a 100644 --- a/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php +++ b/tests/scenarios/PnbDilicom/PnbDilicomDisplayTest.php @@ -56,15 +56,11 @@ class PnbDilicomDisplayBibNumeriqueControllerBlockedUserTest extends AbstractCon 'login'=>'Chat', 'password'=>'123456', 'id_site' => 1, - 'int_bib' => $this->fixture('Class_IntBib', - ['id' => 1, - 'comm_sigb' => Class_IntBib::COM_ORPHEE, - 'comm_params' => $comm_params = ['url_serveur' => 'tests/fixtures/orphee.wsdl', - 'allow_hold_available_items' => true]]), + 'int_bib' => $this->_getOrpheeIntBib(), 'idabon' => '12345', ]); - Class_WebService_SIGB_Orphee::setService($comm_params, + Class_WebService_SIGB_Orphee::setService($this->_getOrpheeCommParams(), new class('http://orphee.wsdl', 'key', false, []) extends Class_WebService_SIGB_Orphee_Service { public function isConnected() { @@ -140,6 +136,21 @@ class PnbDilicomDisplayBibNumeriqueControllerBlockedUserTest extends AbstractCon $this->postDispatch('/bib-numerique/download-loan-book-ajax/id/3', [],true); $this->assertContains('location.href=', $this->_response->getBody()); } + + + protected function _getOrpheeIntBib() { + return $this->fixture(Class_IntBib::class, + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_ORPHEE, + 'comm_params' => $this->_getOrpheeCommParams()]); + } + + + protected function _getOrpheeCommParams() { + return ['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => true]; + } + } @@ -154,7 +165,6 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerTestCase extends AbstractC $_storm_default_to_volatile = true, $_params; - public function setUp() { parent::setUp(); @@ -229,14 +239,11 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerTestCase extends AbstractC $this->book->index(); - RessourcesNumeriquesFixtures::activateDilicom(); - $this->_http = $this->mock(); Class_WebService_BibNumerique_Dilicom_Hub::setDefaultHttpClient($this->_http); - $this->_time_source = new TimeSourceForTest('2014-05-02 14:14:14'); Class_WebService_BibNumerique_Dilicom_Hub::setTimeSource($this->_time_source); Class_Album_UsageConstraint::setTimeSource($this->_time_source); @@ -269,6 +276,20 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerTestCase extends AbstractC } + protected function _getOrpheeIntBib() { + return $this->fixture(Class_IntBib::class, + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_ORPHEE, + 'comm_params' => $this->_getOrpheeCommParams()]); + } + + + protected function _getOrpheeCommParams() { + return ['url_serveur' => 'tests/fixtures/orphee.wsdl', + 'allow_hold_available_items' => true]; + } + + public function tearDown() { Class_WebService_BibNumerique_Dilicom_Hub::setTimeSource(null); Class_Album_UsageConstraint::setTimeSource(null); @@ -287,7 +308,6 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionTestCase public function setUp() { parent::setUp(); $_SERVER['HTTP_REFERER'] = '/viewnotice/id/3'; - Class_AdminVar::set('DILICOM_PNB_LOAN_COUNT_LIMIT', 0); $this->_params['loanEndDate'] = '2014-08-10T14:14:14+0200'; $update_status_url = static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0'; @@ -301,17 +321,17 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionTestCase ->whenCalled('open_url') ->with($update_status_url, ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->willDo(function() use ($update_status_url) - { - $this->_http - ->whenCalled('open_url') - ->with($update_status_url, - ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) - ->answers(DilicomFixtures::getLoanStatusAfterLoanResponse()); - return DilicomFixtures::getLoanStatusResponse(); - }) + { + $this->_http + ->whenCalled('open_url') + ->with($update_status_url, + ['auth' => [ 'user' => 'afi-bib', + 'password' => 'secretPassword']]) + ->answers(DilicomFixtures::getLoanStatusAfterLoanResponse()); + return DilicomFixtures::getLoanStatusResponse(); + }) ->beStrict(); } } @@ -323,7 +343,6 @@ class PnbDilicomDisplayBibNumeriqueControllerMobileTest extends PnbDilicomDispla public function setUp() { parent::setUp(); - $_SERVER['HTTP_USER_AGENT'] = 'iPhone'; Class_Profil::getCurrentProfil() ->beTelephone() @@ -431,8 +450,6 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookWithHoldTest extends PnbDil - - class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends PnbDilicomDisplayBibNumeriqueControllerTestCase { /** @test */ @@ -441,7 +458,7 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'consultBook?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId=x321&accessMedium=STREAMING&localization=IN_SITU&consultEndDate=2014-05-02T15%3A14%3A14%2B0200&ean13=435465&ipAddress=127.0.0.1&glnColl=afi-bib&loanerColl=2345889&loanId=n4y4nq63', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->beStrict(); @@ -458,7 +475,7 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'consultBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&UserInfo.year=1930&UserInfo.gender=H&orderLineId=x321&loanId=n4y4nq63&ean13=435465&accessMedium=STREAMING&localization=IN_SITU&consultEndDate=2014-05-02T15%3A14%3A14%2B0200&ipAddress=127.0.0.1&returnMessage=La+requ%C3%AAte+%22consultBook%22+n%27a+pas+%C3%A9t%C3%A9+trait%C3%A9e+correctement.', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->beStrict(); @@ -474,7 +491,7 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'consultBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&UserInfo.year=1930&UserInfo.gender=H&orderLineId=x321&loanId=n4y4nq63&ean13=435465&accessMedium=STREAMING&localization=IN_SITU&consultEndDate=2014-05-02T15%3A14%3A14%2B0200&ipAddress=127.0.0.1&returnMessage=La+requ%C3%AAte+%22consultBook%22+n%27a+pas+%C3%A9t%C3%A9+trait%C3%A9e+correctement.', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookErrorResponse()) ->beStrict(); @@ -534,7 +551,6 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb } - /** @test */ public function loanBookPopupShouldNotContainsDeviceSelectorIfAdminVarSetButErrorReturned() { Class_AdminVar::set('DILICOM_PNB_CHOOSE_DEVICES', 1); @@ -574,12 +590,12 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query(array_filter($this->_params)), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -597,12 +613,12 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query($this->_params), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -618,12 +634,12 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query(array_filter($this->_params)), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookErrorResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -656,11 +672,11 @@ class PnbDilicomDisplayBibNumeriqueControllerConsultBookActionTest extends PnbDi ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'consultBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&UserInfo.year=1930&UserInfo.gender=H&orderLineId=x321&loanId=n4y4nq63&ean13=435465&accessMedium=STREAMING&localization=IN_SITU&consultEndDate=2014-05-02T15%3A14%3A14%2B0200&ipAddress=195.251.88.223&returnMessage=La+requ%C3%AAte+%22consultBook%22+n%27a+pas+%C3%A9t%C3%A9+trait%C3%A9e+correctement.', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) - ->answers('{"orderLineId":"54e7473f975a2fa6aa4d3e17","consultEndDate":"2014-05-02T15:14:14+0200","loanId":"3","returnStatus":"OK","returnMessage":[],"requestId":"awvzrcttestpnbv2_000000039_201503051511","link":{"url":"https://pnb-test.centprod.com/v3//link/3056000302801/CONSULT/3/9791023501766-FGR9FJJGJCMXYMB8BO87XR9TPHDN9QNS.do","aformatDescription":"EPUB","mimetype":"application/epub+zip","ean13":"9791023501766","format":"E101"}}') + 'password' => 'secretPassword']]) + ->answers('{"orderLineId":"54e7473f975a2fa6aa4d3e17","consultEndDate":"2014-05-02T15:14:14+0200","loanId":"3","returnStatus":"OK","returnMessage":[],"requestId":"awvzrcttestpnbv2_000000039_201503051511","link":{"url":"https://pnb-test.centprod.com/v3//link/3056000302801/CONSULT/3/9791023501766-FGR9FJJGJCMXYMB8BO87XR9TPHDN9QNS.do","aformatDescription":"EPUB","mimetype":"application/epub+zip","ean13":"9791023501766","format":"E101"} +}') ->beStrict(); - $_SERVER['HTTP_X_FORWARDED_FOR'] = '195.251.88.223'; $this->dispatch('/bib-numerique/consult-book/id/3', true); @@ -696,7 +712,8 @@ class PnbDilicomDisplayBibNumeriqueControllerConsultBookWithErrorsActionTest ext $this->_http ->whenCalled('open_url') - ->answers('{"orderLineId":"54e7473f975a2fa6aa4d3e17","consultEndDate":"","loanId":"3","returnStatus":"ERROR","returnMessage":["Crash boom"],"requestId":"awvzrcttestpnbv2_000000039_201503051511","link":{}}'); + ->answers('{"orderLineId":"54e7473f975a2fa6aa4d3e17","consultEndDate":"","loanId":"3","returnStatus":"ERROR","returnMessage":["Crash boom"],"requestId":"awvzrcttestpnbv2_000000039_201503051511","link":{} +}'); $_SERVER['HTTP_REFERER'] = '/viewnotice/id/3'; @@ -772,12 +789,12 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionErrorsTest extends Pn ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query(array_filter($this->_params)), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookErrorResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -830,7 +847,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionTwiceWithSameUserTest ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getEndedLoans?login=afi-bib&password=secretPassword&glnContractor=123456789&loanId%5B0%5D=5', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getEndedLoansResponse()) ->beStrict(); @@ -878,6 +895,60 @@ abstract class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionGuestTestCas +class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithOtherSigbTestShouldAskPasswordIdAbon + extends PnbDilicomDisplayBibNumeriqueControllerLoanBookActionTestCase { + + public function setUp() { + parent::setUp(); + + Class_Users::find(6)->setIntBib( + $this->fixture(Class_IntBib::class, + ['id' => 3, + 'comm_params' => ['url_serveur' => 'http://kohaurl'], + 'comm_sigb' => Class_IntBib::COM_KOHA + ]))->save(); + + $this->dispatch('/bib-numerique/loan-book/id/3'); + } + + + /** @test */ + public function responseShouldRedirectToAlbumRecord38() { + $this->assertRedirectTo('https://pnb-dilicom.centprod.com/v3//link/3025594195810/LOAN/WIKI001/9782021153057-NUMOIY0785CYO0IGCV83DE9DOAOC1Y1O.do'); + } +} + + + + +class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithOrpheeTestShouldAskPasswordIdAbon + extends PnbDilicomDisplayBibNumeriqueControllerLoanBookActionTestCase { + + public function setUp() { + parent::setUp(); + $this->setParams(3); + Class_Users::find(6)->setIntBib($this->_getOrpheeIntBib())->save(); + $this->dispatch('/bib-numerique/loan-book/id/3'); + } + + + public function setParams($loan_id) { + parent::setParams($loan_id); + $this->_params['DRMinfo.ReaderId'] = 'Chat'; + $this->_params['DRMinfo.readerPass'] = 'MTA='; + $this->_params['DRMinfo.readerHint'] = 'Merci de saisir votre identifiant de connexion renseigné lors de votre inscription'; + } + + + /** @test */ + public function responseShouldRedirectToAlbumRecord38() { + $this->assertRedirectTo('https://pnb-dilicom.centprod.com/v3//link/3025594195810/LOAN/WIKI001/9782021153057-NUMOIY0785CYO0IGCV83DE9DOAOC1Y1O.do'); + } +} + + + + class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionGuestWithOtherGuestsLoansTest extends PnbDilicomDisplayBibNumeriqueControllerLoanBookActionGuestTestCase { @@ -970,7 +1041,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionGuestWithExceededLoan ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getEndedLoans?login=afi-bib&password=secretPassword&glnContractor=123456789&loanId%5B0%5D=10001&loanId%5B1%5D=10002&loanId%5B2%5D=10003&loanId%5B3%5D=10004&loanId%5B4%5D=10005&loanId%5B5%5D=10006', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getEndedLoansResponse()) ; @@ -1024,7 +1095,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithASecondUserAndLoa ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusNoSimultaneousLoanLeftResponse()) ->beStrict(); @@ -1057,7 +1128,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionBookUnavailableTest e ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -1074,7 +1145,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionBookUnavailableTest e ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -1097,12 +1168,12 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithTwoItemsTest exte ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x458&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()) ->beStrict(); @@ -1144,7 +1215,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithTwoItemsTest exte ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query( array_filter($this->_params)), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->beStrict(); @@ -1160,13 +1231,13 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithTwoItemsTest exte ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x458&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusNoSimultaneousLoanLeftResponse()) ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'loanBook?login=afi-bib&password=secretPassword&glnContractor=123456789&glnLoaner=2345889&'.http_build_query( array_filter($this->_params)), ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::loanBookResponse()) ->beStrict(); @@ -1196,7 +1267,7 @@ class PnbDilicomDisplayLoanBookWithASecondUserAndGlobalLoanCountExcededTest $this->_http->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusWithLoanList(2, 30, 24, DilicomFixtures::generateLoans(3))); @@ -1230,7 +1301,6 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionUserLoanCountExceeded ->whenCalled('open_url') ->answers(''); - Class_AdminVar::set('DILICOM_PNB_MAX_LOAN_PER_USER', 3); foreach(range(1, 3) as $step) $this->fixture('Class_Loan_Pnb', @@ -1304,7 +1374,7 @@ class PnbDilicomDisplayBibNumeriqueControllerLoanBookActionWithASecondUserAndOff ->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusResponse()); $this->_time_source = new TimeSourceForTest('2018-05-02 14:14:14'); @@ -1333,7 +1403,7 @@ class PnbDilicomDisplayHoldBookTest extends PnbDilicomDisplayBibNumeriqueControl $this->_http->whenCalled('open_url') ->with(static::BASE_TEST_URL.'getLoanStatus?login=afi-bib&password=secretPassword&glnContractor=123456789&orderLineId%5B0%5D=x321&returnEndedLoan=0', ['auth' => [ 'user' => 'afi-bib', - 'password' => 'secretPassword']]) + 'password' => 'secretPassword']]) ->answers(DilicomFixtures::getLoanStatusWithLoanList(5, 30, 24, $loans)); $this->fixture('Class_Loan_Pnb', @@ -1429,9 +1499,9 @@ class PnbDilicomDisplayHoldBookTest extends PnbDilicomDisplayBibNumeriqueControl public function holdBookThreeShouldNotifyHoldErrorHoldMaxCountPerUserReached() { foreach(Class_Hold_Pnb::findAll() as $i => $hold) $hold - ->setUser(Class_Users::getIdentity()) - ->setRecordOriginId('Dilicom-other' . $i) - ->save(); + ->setUser(Class_Users::getIdentity()) + ->setRecordOriginId('Dilicom-other' . $i) + ->save(); $this->dispatch('/bib-numerique/hold-book/id/3'); $this->assertFlashMessengerContentContains('Réservation impossible. Le nombre de réservations autorisé par utilisateur (2) est atteint.'); @@ -1531,7 +1601,6 @@ class PnbDilicomDisplayAbonneHoldsTest extends PnbDilicomDisplayBibNumeriqueCont 'hold_date' => '2022-06-07 20:10:00', 'expiration_date' => '2022-06-15 20:10:00']); - $this->fixture('Class_Hold_Pnb', ['id' => 3, 'user_id' => 6, @@ -1539,7 +1608,6 @@ class PnbDilicomDisplayAbonneHoldsTest extends PnbDilicomDisplayBibNumeriqueCont 'hold_date' => '2022-01-01 20:10:00', 'expiration_date' => '2022-01-01 20:10:00']); - $this->fixture('Class_Hold_Pnb', ['id' => 4, 'user_id' => 666, @@ -1700,10 +1768,10 @@ class PnbDilicomDisplayAbonneDeletePnbHoldTest extends PnbDilicomDisplayBibNumer $this->assertFlashMessengerContentContains('Votre réservation du document Totem et Thora a bien été supprimée.'); } + /** @test */ public function whenDeletePnbHoldCalledWithInexistantIdShouldDisplayError() { $this->dispatch('/abonne/delete-pnb-hold/id/42'); $this->assertFlashMessengerContentContains('La réservation recherchée avec l\'identifiant 42 n\'a pas été trouvée.'); - } }