"...opac/controllers/OAIControllerListMetadataFormatsTest.php" did not exist on "1441ba0cb841d616a7f55deaadfb584c4a4437ce"
Newer
Older
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH 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).
*
* BOKEH 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 BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class RechercheControllerAlbumWebSiteTestCase extends AbstractControllerTestCase {
protected
$_wikipedia,
$_linuxfr,
$_framasoft,
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_website_category = $this->fixture('Class_AlbumCategorie',
['id' => 1,
'libelle' => 'Websites']);
$this
->_setupWikipedia()
->_setupLinuxFr()
->_setupFramasoft();
}
protected function _setupWikipedia() {
$this->_wikipedia = $this->fixture('Class_Album',
['id' => 1,
'type_doc_id' => Class_TypeDoc::WEBSITE,
'titre' => 'Wikipedia',
'status' => Class_Album::STATUS_VALIDATED]);
$this->_wikipedia
->addRessource($this->fixture('Class_AlbumRessource',
['id' => 1,
'titre' => 'Wikipedia',
'url' => 'http://www.wikipedia.org']))
->assertSave();
$this->_wikipedia->index();
return $this;
}
protected function _setupLinuxFr() {
$this->_linuxfr = $this->fixture('Class_Album',
['id' => 2,
'type_doc_id' => Class_TypeDoc::WEBSITE,
'titre' => 'Linuxfr',
'status' => Class_Album::STATUS_VALIDATED]);
$this->_linuxfr
->addRessource($this->fixture('Class_AlbumRessource',
['id' => 21,
'titre' => 'Linuxfr',
'description' => 'Toutes les news linux francophones',
'poster' => 'linuxfr.jpg',
'url' => 'http://www.linuxfr.org']))
->assertSave();
$this->_linuxfr->index();
return $this;
}
protected function _setupFramasoft() {
$this->_framasoft = $this->fixture('Class_Album',
['id' => 3,
'type_doc_id' => Class_TypeDoc::WEBSITE,
'titre' => 'Framasoft',
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
'status' => Class_Album::STATUS_VALIDATED]);
$this->_framasoft
->addRessource($this->fixture('Class_AlbumRessource',
['id' => 31,
'titre' => 'Framabee',
'poster' => 'framabee.jpg',
'url' => 'http://www.framabee.org']))
->addRessource($this->fixture('Class_AlbumRessource',
['id' => 32,
'titre' => 'Framasphere',
'poster' => 'framasphere.jpg',
'url' => 'http://www.framasphere.org']))
->addRessource($this->fixture('Class_AlbumRessource',
['id' => 33,
'titre' => 'Framabin',
'poster' => 'framabin.jpg',
'url' => 'http://www.framabin.org']))
->assertSave();
$this->_framasoft->index();
return $this;
}
}
class RechercheControllerAlbumWebSiteTest extends RechercheControllerAlbumWebSiteTestCase {
/** @test */
public function albumIsWebSiteShouldBeTrue() {
$this->assertTrue($this->_wikipedia->isWebSite());
}
}
class RechercheControllerAlbumWebSiteWikipediaResNumeriquesTest extends RechercheControllerAlbumWebSiteTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/noticeajax/resnumeriques/id_notice/1', true);
}
/** @test */
public function iframeShouldHaveSrcWikipediaDotOrg() {
$this->assertXPath('//a/iframe[@src="http://www.wikipedia.org"]',
$this->_response->getBody());
}
}
class RechercheControllerAlbumWebSiteLinuxFrResNumeriquesTest extends RechercheControllerAlbumWebSiteTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/noticeajax/resnumeriques/id_notice/2', true);
}
/** @test */
public function descriptionShouldBeDisplayedInAParagraph() {
$this->assertXPathContentContains('//section//p',
'Toutes les news linux',
$this->_response->getBody());
}
/** @test */
public function titleShouldBeDisplayedInAH3() {
$this->assertXPathContentContains('//section/h3',
'Linuxfr');
}
/** @test */
public function imageLinuxFRDotJpgShouldBeDisplayedInAnchorToLinuxFR() {
$this->assertXPath('//a[@href="http://www.linuxfr.org"]'.
'//img[contains(@src, "linuxfr.jpg")][@title="Ouvrir le site dans un nouvel onglet"]',
$this->_response->getBody());
}
}
class RechercheControllerAlbumWebSiteFramasoftResNumeriquesTest extends RechercheControllerAlbumWebSiteTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/noticeajax/resnumeriques/id_notice/3', true);
}
/** @test */
public function imageFramabeeDotJpgShouldBeDisplayedInAnchorToFramabee() {
$this->assertXPath('//a[@href="http://www.framabee.org"]'.
'//img[contains(@src, "framabee.jpg")][@title="Ouvrir le site dans un nouvel onglet"]',
$this->_response->getBody());
}
/** @test */
public function imageFramabinDotJpgShouldBeDisplayedInAnchorToFramabin() {
$this->assertXPath('//a[@href="http://www.framabin.org"]'.
'//img[contains(@src, "framabin.jpg")][@title="Ouvrir le site dans un nouvel onglet"]',
$this->_response->getBody());
}
}
class RechercheControllerAlbumWebSiteViewBibNumCategoryTest extends RechercheControllerAlbumWebSiteTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/bib-numerique/view-categorie/id/1');
}
/** @test */
public function linuxFrTitleShouldLinkToWebsite() {
$this->assertXPathContentContains('//div[@class="sitotheque"]/h2/a[@href="http://www.linuxfr.org"][@target="_blank"]', 'Linuxfr');
}
/** @test */
public function framasoftTitleShouldLinkToViewAlbum() {
$this->assertXPathContentContains('//div/h2/a[@href="/bib-numerique/view-album/id/3"]', 'Framasoft', $this->_response->getBody());
}
}