From 56ff755b1dec021d9abeac730684fedb8b214580 Mon Sep 17 00:00:00 2001
From: lbrun <leo@sandbox.pergame.net>
Date: Thu, 29 Oct 2015 15:36:03 +0100
Subject: [PATCH] dev#25569 : add tests

---
 .../ProfilOptionsControllerTest.php           | 33 +++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
index 9b63ad86fe9..5ef11c07bcc 100644
--- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
+++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php
@@ -2557,18 +2557,47 @@ class ProfilOptionsControllerRecentSitoTest extends ProfilOptionsControllerProfi
                                                       'tags' => 'Smalltalk'])]
                    ]);
 
-
-    $this->dispatch('/opac/index/index/clef/zork?id_profil=12', true);
   }
 
   /** @test */
   public function sitothequeShouldContainsLinkToCursus() {
+    $this->dispatch('/opac/index/index/clef/zork?id_profil=12', true);
     $this->assertXPathContentContains('//a[@href="http://cursus.edu/"]', 'Thot cursus');
   }
 
 
   /** @test */
   public function sitothequeShouldNotContainsLinkToPharo() {
+    $this->dispatch('/opac/index/index/clef/zork?id_profil=12', true);
     $this->assertNotXPathContentContains('//a[@href="http://pharo.org/"]', 'Pharo');
   }
+
+
+  /** @test */
+  public function withoutCategoryShouldDisplay2Sitos() {
+    $this->page_jeux->setCfgAccueil(['modules' => [
+                                                   '10' => ['division' => '2',
+                                                            'type_module' => 'SITO',
+                                                            'preferences' => ['id_categorie' => '',
+                                                                              'type_aff' => '2']]],
+                                     'options' =>   []]);
+
+    $this->dispatch('/opac/index/index/clef/zork?id_profil=12', true);
+    $this->assertXPathCount('//div[@class="sitotheque"]', 2);
+  }
+
+
+  /** @test */
+  public function with1CategoryAnd1ItemShouldDisplay2Sitos() {
+    $this->page_jeux->setCfgAccueil(['modules' => [
+                                                   '10' => ['division' => '2',
+                                                            'type_module' => 'SITO',
+                                                            'preferences' => ['id_categorie' => '2',
+                                                                              'id_items' => '35',
+                                                                              'type_aff' => '2']]],
+                                     'options' =>   []]);
+
+    $this->dispatch('/opac/index/index/clef/zork?id_profil=12', true);
+    $this->assertXPathCount('//div[@class="sitotheque"]', 2);
+  }
 }
\ No newline at end of file
-- 
GitLab