From 70d09c84597480179fce75831f37ee407aa1caec Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 26 Feb 2019 10:16:08 +0100 Subject: [PATCH] dev #64573 fix failures --- .../ZendAfi/View/Helper/FonctionsAdmin.php | 8 ++-- .../templates/Intonation/Library/Pictures.php | 16 +++----- .../controllers/RecordsControllerTest.php | 2 +- .../opac/controllers/AuthControllerTest.php | 4 +- ...ercheControllerHistoriqueRechercheTest.php | 6 +-- .../View/Helper/Accueil/KiosqueTest.php | 2 +- .../View/Helper/Accueil/RechSimpleTest.php | 2 +- tests/scenarios/Templates/TemplatesTest.php | 41 +++++++++++++++---- 8 files changed, 51 insertions(+), 30 deletions(-) diff --git a/library/ZendAfi/View/Helper/FonctionsAdmin.php b/library/ZendAfi/View/Helper/FonctionsAdmin.php index 3aa61ddf9e9..7811120301a 100644 --- a/library/ZendAfi/View/Helper/FonctionsAdmin.php +++ b/library/ZendAfi/View/Helper/FonctionsAdmin.php @@ -61,11 +61,13 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper $html = trim(implode(' ', array_filter($actions))); + $class = (($this->_widget instanceof Class_Systeme_Widget_Section) + ? 'section_configuration' + : 'configuration_module'); + return $html ? $this->_tag('div', $html, - ['class' => (($this->_widget instanceof Class_Systeme_Widget_Section) - ? 'section_configuration' - : 'configuration_module'), + ['class' => $class, 'style' => 'text-align:right']) : ''; } diff --git a/library/templates/Intonation/Library/Pictures.php b/library/templates/Intonation/Library/Pictures.php index 5a9869d5dc5..aff294dab20 100644 --- a/library/templates/Intonation/Library/Pictures.php +++ b/library/templates/Intonation/Library/Pictures.php @@ -41,17 +41,11 @@ class Intonation_Library_Pictures { public function pictures() { $model_title = $this->_model->getTitrePrincipal(' '); - $pictures = []; - - if (!$this->_canGetPicturesFronLastFm()) - return $pictures; - - if (!$more_pictures = (new Intonation_Library_LastFm) - ->setModel($this->_model) - ->getAlbumPictures()) - return $pictures; - - return array_merge($pictures, $more_pictures); + return $this->_canGetPicturesFronLastFm() + ? ((new Intonation_Library_LastFm) + ->setModel($this->_model) + ->getAlbumPictures()) + : []; } diff --git a/tests/application/modules/admin/controllers/RecordsControllerTest.php b/tests/application/modules/admin/controllers/RecordsControllerTest.php index 306ab36bb93..ad318269f17 100644 --- a/tests/application/modules/admin/controllers/RecordsControllerTest.php +++ b/tests/application/modules/admin/controllers/RecordsControllerTest.php @@ -375,7 +375,7 @@ class RecordsControllerBiographyTest extends RecordsControllerTestCase { /** @test */ public function formShouldHaveInputUrlAuteur() { - $this->assertXPath('//form//input[@type="url"][@name="url_auteur"][contains(@placeholder, "ex: http://fr.wikipedia.org/wiki/Henri_Laborit")]'); + $this->assertXPath('//form//input[@type="text"][@name="url_auteur"][contains(@placeholder, "ex: http://fr.wikipedia.org/wiki/Henri_Laborit")]'); } } diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index abb828ba827..ca0f11050fe 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -793,13 +793,13 @@ class AuthControllerAdminIsLoggedTest extends PortailWithOneLoginModuleTestCase /** @test */ public function pageShouldContainsConfigurationLink() { - $this->assertXPath("//div[@class='configuration_module']//a[contains(@href,'admin/modules/auth/config/site/type_module/auth/id_profil/2/action1/login')]", $this->_response->getBody()); + $this->assertXPath("//div[contains(@class,'configuration')]//a[contains(@href,'admin/modules/auth/config/site/type_module/auth/id_profil/2/action1/login')]"); } /** @test */ public function pageShouldContainsApplyToLink() { - $this->assertXPath("//div[@class='configuration_module']//a[contains(@href,'admin/modules/apply-to/config/site/type_module/auth/id_profil/2/action1/login')]"); + $this->assertXPath("//div[contains(@class, 'configuration')]//a[contains(@href,'admin/modules/apply-to/config/site/type_module/auth/id_profil/2/action1/login')]"); } diff --git a/tests/application/modules/opac/controllers/RechercheControllerHistoriqueRechercheTest.php b/tests/application/modules/opac/controllers/RechercheControllerHistoriqueRechercheTest.php index 1d4a33c43ec..b30c487b7ec 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerHistoriqueRechercheTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerHistoriqueRechercheTest.php @@ -55,8 +55,6 @@ class RechercheControllerHistoriqueRechercheTest extends AbstractControllerTestC /** @test */ public function configAdminShouldHaveAction1SaisieInUrl() { - $this->assertXPath('//div[@class="configuration_module"]//a[contains(@href, "action1/saisie")]'); + $this->assertXPath('//div[@class="section_configuration"]//a[contains(@href, "action1/saisie")]'); } -} - -?> +} \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php index 73edf879b1a..e320db96f6a 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php @@ -398,7 +398,7 @@ class ZendAfi_View_Helper_Accueil_KiosqueRequetesAsRedacteurTest extends ZendAfi /** @test **/ public function boiteKiosqueWithAdminLoggedShouldContainsLinkToChange() { - $this->assertXPath($this->_html, '//div[@class="boite kiosque"]//div[@class="configuration_module"]/a[contains(@href,"admin/modules/kiosque-change-data")]'); + $this->assertXPath($this->_html, '//div[@class="boite kiosque"]//div[contains(@class, "configuration")]/a[contains(@href,"admin/modules/kiosque-change-data")]'); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php index 6930764b975..26ff9f47588 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php @@ -58,7 +58,7 @@ class ZendAfi_View_Helper_Accueil_RechSimpleWithAdminTest extends ZendAfi_View_H /** @test */ public function adminActionsShouldBePresent() { - $this->assertLocalXPath('//div[@class="configuration_module"]'); + $this->assertLocalXPath('//div[@class="section_configuration"]'); } diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 1d16e095f2e..12e6bc6174f 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -771,7 +771,7 @@ class TemplatesDispatchIntonationSearchTest extends TemplatesIntonationTestCase /** @test */ public function searchResultShouldBeDisplay() { - $this->assertXPathContentContains('//h1', 'Résultat de la recherche'); + $this->assertXPathContentContains('//h1', 'Résultats pour pomme'); } @@ -2148,14 +2148,42 @@ class TemplatesDispatchNoticeAjaxPicturesTest extends TemplatesIntonationTestCas /** @test */ public function shouldDisplayBigPicture() { + $unimarc = (new Class_NoticeUnimarc_Fluent) + ->zoneWithContent('001', '12345') + + ->zoneWithChildren('200', ['f' => 'ShŠAimoto']); + $record = $this->fixture('Class_Notice', ['id' => 456, - 'titre_principal' => 'Psycho', - 'type_doc' => 8, + 'titre_principal' => 'Hadès, chasseur de psycho-démons', + 'unimarc' => $unimarc->render(), + 'type_doc' => 4, 'clef_oeuvre' => 'PSYKO', - 'url_vignette' => 'big_picture_300x300.jpg', 'facettes' => 'G13 M12']); + $web_client = $this + ->mock()->beStrict() + + ->whenCalled('getResponse') + ->with('https://www.last.fm/music/Sh%C5%8D+Aimoto/+images/') + ->answers((new Class_Testing_HttpResponse)->setBody(' +<html lang="fr"> + <head></head> + <body> + <ul class="image-list"> + <li class="image-list-item"> + <a href="/music/Sh%C5%8D+Aimoto/+images/" class="image-list-link"> + <img class="image-list-image" + src="https://lastfm-img2.akamaized.net/i/u/avatar170s/big_picture_300x300.jpg" + alt="None"> + </a> + </li> + </ul> + </body> +</html>')); + + Class_WebService_SimpleWebClient::setInstance($web_client); + $this->dispatch('/noticeajax/pictures/id/456/id_profil/72'); $this->assertXPath('//div/img[contains(@src,"big_picture_300x300.jpg")]'); } @@ -2356,8 +2384,7 @@ class TemplatesSearchRecordsTest extends TemplatesIntonationTestCase { /** @test */ - public function dispatchViewRecordShouldDisplayPsycho() { - $this->assertXPathContentContains('//h1', - 'Psycho'); + public function shouldDisplayResultsForPsycho() { + $this->assertXPathContentContains('//h1', 'Résultats pour psyko'); } } \ No newline at end of file -- GitLab