Skip to content
Snippets Groups Projects
SitoControllerTest.php 2.54 KiB
Newer Older
<?php
/**
 * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
 *
 * AFI-OPAC 2.0 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).
 *
 * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
 */
class SitoControllerViewViewSelectionTest extends AbstractControllerTestCase {
	public function setUp() {
		parent::setUp();

		$this->fixture('Class_SitothequeCategorie',
									 ['id' => 3,
										'libelle' => 'Hackers']);

		$this->fixture('Class_Sitotheque',
									 ['id' => 5,
										'id_cat' => 3,
										'titre' => 'LinuxFr',
										'description' => 'Pour tous les linuxiens',
										'url' => 'http://linuxfr.org']);


		$this->fixture('Class_Sitotheque',
									 ['id' => 28,
										'id_cat' => 0,
										'titre' => 'Hurd',
										'description' => 'Pour tous les Gnus',
										'url' => 'http://hurd.gnu.org']);


		Class_Profil::getCurrentProfil()
			->setCfgAccueil([
												'modules' => [
													'1' => 	[
														'division' => '2',
														'type_module' => 'SITO',
														'preferences' => ['id_categorie' => '3',
																							'id_items' => '25-28']
														]
													],
												'options' => 	[]]);

		$this->dispatch('/sito/viewselection/id_module/1', true);

	}

	/** @test */
	public function siteLinuxFrShouldBeVisible() {
		$this->assertXPath('//div[@class="contenu"]//div[@class="sitotheque"]//a[@href="http://linuxfr.org"]',
											 $this->_response->getBody());
	}


	/** @test */
	public function siteHurdDotOrgShouldBeVisible() {
		$this->assertXPath('//div[@class="contenu"]//div[@class="sitotheque"]//a[@href="http://hurd.gnu.org"]',
											 $this->_response->getBody());
	}


	/** @test */
	public function descriptionSiteLinuxFrShouldBeVisible() {
		$this->assertXPathContentContains('//div[@class="contenu"]//div[@class="sitotheque"]',
																			'Pour tous les linuxiens');
	}
}
?>