Commit 6cadd3d4 authored by gloas's avatar gloas

Domain Browsing -> adding leaf case

parent 7a2c92ed
......@@ -542,12 +542,25 @@ class RechercheController extends ZendAfi_Controller_Action {
$subdomains=$catalogue->getChildren();
$this->view->datas_view=[];
foreach($subdomains as $subdomain) {
$this->view->datas_view[]=$this->view->url(['controller' =>'recherche',
'action' => 'domains-browsing',
'id_catalogue'=> $subdomain->getId(),
'fil' => $fil],null,true);
$this->view->datas_view[]=$this->getBrowsingChildUrl($subdomain, $fil);
}
}
protected function getBrowsingChildUrl($subdomain, $fil) {
return
$subdomain->hasSousDomaines()
? $this->view->url(['controller' =>'recherche',
'action' => 'domains-browsing',
'id_catalogue'=> $subdomain->getId(),
'fil' => $fil],null,true)
: $this->view->url(['controller' =>'recherche',
'action' => 'simple',
'id_catalogue'=> $subdomain->getId(),
'fil' => $fil],null,true);
}
}
?>
\ No newline at end of file
<?php
xdebug_break();
foreach($this->datas_view as $data)
echo $this->tagAnchor($data,$data);
?>
......@@ -1688,9 +1688,9 @@ class RechercheControllerViewNoticeWichIsInMyPanier extends AbstractControllerTe
Class_PanierNoticeCatalogue::beVolatile();
$this->user = Class_Users::newInstanceWithId(23, ['pseudo' => 'Pioup',
'nom' => 'Jojo',
'login' => 'Super',
'password' => '123789']);
'nom' => 'Jojo',
'login' => 'Super',
'password' => '123789']);
$this->user->save();
ZendAfi_Auth::getInstance()->logUser($this->user);
......@@ -1704,17 +1704,17 @@ class RechercheControllerViewNoticeWichIsInMyPanier extends AbstractControllerTe
$this->panier_bd->save();
$this->panier_bd_2 = Class_PanierNotice::newInstanceWithId(3,
['id_panier' => 1,
'libelle' => 'Mes BD 2',
'date_maj' => '10/02/2011',
'notices' => 'POIRE',
'user' => $this->user]);
['id_panier' => 1,
'libelle' => 'Mes BD 2',
'date_maj' => '10/02/2011',
'notices' => 'POIRE',
'user' => $this->user]);
$this->panier_bd_2->save();
$pomme = Class_Notice::newInstanceWithId(10,
['titre_principal' => 'Le combat des pommes',
'clef_alpha' => 'POMME',
'date_creation' => '2010-01']);
'date_creation' => '2010-01']);
$poire = Class_Notice::newInstanceWithId(12, ['titre_principal' => 'Le combat des poires',
'clef_alpha' => 'POIRE',
......@@ -1736,7 +1736,7 @@ class RechercheControllerViewNoticeWichIsInMyPanier extends AbstractControllerTe
}
/** @test **/
/** @test **/
public function viewNoticePommeShouldContainsLinkAddToPanier() {
$this->dispatch('recherche/viewnotice/id/10',true);
$this->assertXpath('//div[@class="navigation"]/a[@class="panier dans_panier"]',$this->_response->getBody());
......@@ -1766,9 +1766,9 @@ class RechercheControllerViewNoticeWichIsInMyPanier extends AbstractControllerTe
/** @test **/
public function withOutLoggedUserFlagsNoticeShouldNotContainsDansPanier() {
ZendAfi_Auth::getInstance()->clearIdentity();
$this->dispatch('recherche/viewnotice/id/12',true);
$this->assertNotXpath('//div[@class="flags_notice"]/span[@class="dans_panier"]',$this->_response->getBody());
ZendAfi_Auth::getInstance()->clearIdentity();
$this->dispatch('recherche/viewnotice/id/12',true);
$this->assertNotXpath('//div[@class="flags_notice"]/span[@class="dans_panier"]',$this->_response->getBody());
}
}
......@@ -1795,10 +1795,10 @@ class RechercheControllerSimpleActionWithCvsActivatedTest extends RechercheContr
'rights_token' => Class_UserGroup::RIGHT_ACCES_CVS]);
$polo = $this->fixture('Class_Users', ['id' => 15,
'login' => 'polo',
'password' => '456',
'pseudo' => 'polo',
'date_fin' => '2025-04-26'])
'login' => 'polo',
'password' => '456',
'pseudo' => 'polo',
'date_fin' => '2025-04-26'])
->beAbonneSIGB()
->setUserGroups([$group_cvs]);
......@@ -1866,13 +1866,13 @@ class RechercheControllerSimpleActionWithCvsActivatedAndPreferencesHiddenTest ex
'idabon' => '98475',
'id_site' => 2,
'password' => 'xzy']);
$group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia',
'rights_token' => Class_UserGroup::RIGHT_ACCES_CVS]);
$group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia',
'rights_token' => Class_UserGroup::RIGHT_ACCES_CVS]);
$zork->beAbonneSIGB()
->setUserGroups([$this->group_multimedia])
->save();
$zork->beAbonneSIGB()
->setUserGroups([$this->group_multimedia])
->save();
ZendAfi_Auth::getInstance()->logUser($zork);
RessourcesNumeriquesFixtures::activateCVS();
......@@ -1897,15 +1897,46 @@ class RechercheControllerDomainsBrowsing extends AbstractControllerTestCase {
$this->a_letter_domain = $this->fixture('Class_Catalogue',['id'=>4,
'domaine_parent' => $this->youth_domain,
'libelle' => 'A']);
$this->c_letter_domain = $this->fixture('Class_Catalogue',['id'=>6,
'domaine_parent' => $this->youth_domain,
'libelle' => 'C']);
$this->animals_domain = $this->fixture('Class_Catalogue',['id'=>10,
'domaine_parent' => $this->a_letter_domain,
'libelle' => 'Animals']);
$this->dispatch('/recherche/domains-browsing/id_catalogue/3');
$this->car_domain = $this->fixture('Class_Catalogue',['id'=>15,
'domaine_parent' => $this->c_letter_domain,
'libelle' => 'Car']);
$this->cinema_domain = $this->fixture('Class_Catalogue',['id'=>25,
'domaine_parent' => $this->c_letter_domain,
'libelle' => 'Cinema']);
}
/** @test */
public function browsingYouthDomainShouldDisplayLinkToLetterADomain() {
$this->assertXPath('//a[@href="/recherche/domains-browsing/id_catalogue/4/fil/3"]',$this->_response->getBody());
$this->dispatch('/recherche/domains-browsing/id_catalogue/3');
$this->assertXPath('//a[@href="/recherche/domains-browsing/id_catalogue/4/fil/3"]');
}
/** @test */
public function browsingYouthDomainShouldDisplayLinkToLetterCDomain() {
$this->dispatch('/recherche/domains-browsing/id_catalogue/3');
$this->assertXPath('//a[@href="/recherche/domains-browsing/id_catalogue/6/fil/3"]');
}
/** @test */
public function browsingADomainShouldDisplayLinkAnimalsDomainAsRechercheSimple() {
$this->dispatch('/recherche/domains-browsing/id_catalogue/4/fil/3');
$this->assertXPath('//a[@href="/recherche/simple/id_catalogue/10/fil/3%3B4"]');
}
/** @test **/
public function browsingCLetterDomainShouldDisplayLinkToCarAndLinkToCinema() {
$this->dispatch('/recherche/domains-browsing/id_catalogue/6/fil/3');
$this->assertXPathCount('//a[contains(@href,"/recherche/simple/id_catalogue")]', 2);
}
}
?>
......
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment