Skip to content
Snippets Groups Projects
Commit 234905d2 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

remove useless tests + add httpclient mock

parent 42183e1b
2 merge requests!715Master,!670Master
......@@ -16,7 +16,7 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
......@@ -24,13 +24,17 @@ require_once 'AbstractControllerTestCase.php';
abstract class RechercheControllerAlbumAudioRecordTestCase extends AbstractControllerTestCase {
protected
protected
$_notice,
$_codif_auteur_wrapper;
public function setUp() {
parent::setUp();
$_http_client = Storm_Test_ObjectWrapper::mock()->whenCalled('open_url')->answers(null);
Class_WebService_AllServices::setHttpClient($_http_client);
Class_Notice::beVolatile();
Class_Notice::setTimeSource(new TimeSourceForTest('2014-01-19 09:00:00'));
Class_Exemplaire::beVolatile();
......@@ -42,7 +46,7 @@ abstract class RechercheControllerAlbumAudioRecordTestCase extends AbstractContr
Class_CosmoVar::newInstanceWithId('black_list_856', ['valeur' => 'mabib']);
Class_CosmoVar::newInstanceWithId('unimarc_zone_titre',
['valeur' => '200$a;200$e;200$d;200$i;327$a;464$a;461$t;464$t']);
$album = $this->fixture('Class_Album',
['id' => 4,
'type_doc_id' => Class_TypeDoc::AUDIO_RECORD,
......@@ -88,7 +92,7 @@ abstract class RechercheControllerAlbumAudioRecordTestCase extends AbstractContr
$code_alpha = str_replace(' ', 'x', $indexation->alphaMaj($name.'|'));
$author = Class_CodifAuteur::newInstance([ 'formes' => $code_alpha,
'libelle' => $name]);
$author->assertSave();
$author->save();
$this->_codif_auteur_wrapper
->whenCalled('findFirstBy')
......@@ -116,24 +120,12 @@ class RechercheControllerAlbumAudioRecordViewNoticeTest extends RechercheControl
/** @test */
public function clefAlphaShouldBeSEVENTHSON_IRONMAIDEN() {
$this->assertEquals('SEVENTHSONOFASEVENTHSON--IRONMAIDENBRUCEDICKINSONSTEVEHARRISDAVEMURRAYNICKOMCBRAINADRIANSMITH----109',
$this->assertEquals('SEVENTHSONOFASEVENTHSON--IRONMAIDENBRUCEDICKINSONSTEVEHARRISDAVEMURRAYNICKOMCBRAINADRIANSMITH----109',
$this->_notice->getClefAlpha());
}
/** @test */
public function noticeShouldNotHaveUrlImageSet() {
$this->assertEmpty($this->_notice->getUrlImage());
}
/** @test */
public function noticeShouldNotHaveUrlVignetteSet() {
$this->assertEmpty($this->_notice->getUrlVignette());
}
/**
/**
* @disabledtest
* en attendant de bien gérer la nouveauté pour les albums bib num (update de notice et non nouvelle création
*/
......@@ -151,7 +143,7 @@ class RechercheControllerAlbumAudioRecordViewNoticeTest extends RechercheControl
/** @test */
public function titrePrincipalShouldBeSeventhSonOfASeventhSon() {
$this->assertXPathContentContains('//h1',
$this->assertXPathContentContains('//h1',
'Seventh Son of a Seventh Son',
$this->_response->getBody());
}
......@@ -186,28 +178,28 @@ class RechercheControllerAlbumAudioRecordViewNoticeTest extends RechercheControl
/** @test */
public function titresFulltextShouldContainsMOONCHILD() {
$this->assertContains('MOONCHILD',
$this->assertContains('MOONCHILD',
explode(' ', $this->_notice->getRawAttributes()['titres']));
}
/** @test */
public function titresFulltextShouldContainsUNKNOWN() {
$this->assertContains('UNKNOWN',
$this->assertContains('UNKNOWN',
explode(' ', $this->_notice->getRawAttributes()['titres']));
}
/** @test */
public function titresFulltextShouldContainsPROPHECY() {
$this->assertContains('PROPHECY',
$this->assertContains('PROPHECY',
explode(' ', $this->_notice->getRawAttributes()['titres']));
}
/** @test */
public function titresFulltextShouldNotContains502() {
$this->assertNotContains('502',
$this->assertNotContains('502',
explode(' ', $this->_notice->getRawAttributes()['titres']));
}
......@@ -291,7 +283,7 @@ class RechercheControllerAlbumAudioRecordViewDetailsTest extends RechercheContro
/** @test */
public function titresShouldContainsIronMaidenAsCodeRebond() {
$this->assertXPathContentContains('//dd//a[contains(@href, "code_rebond/A1")]',
$this->assertXPathContentContains('//dd//a[contains(@href, "code_rebond/A1")]',
'Iron Maiden');
}
......@@ -300,13 +292,13 @@ class RechercheControllerAlbumAudioRecordViewDetailsTest extends RechercheContro
$this->assertNotXPath('//dt[contains(@class, "internet")]', $this->_response->getBody());
}
/** @test */
public function distributorShouldBeGeffenRecords() {
$this->assertXPathContentContains('//dl//dd',
$this->assertXPathContentContains('//dl//dd',
'Geffen Records',
$this->_response->getBody());
}
}
/** @test */
......@@ -317,7 +309,7 @@ class RechercheControllerAlbumAudioRecordViewDetailsTest extends RechercheContro
/** @test */
public function aDDForAuthorsShouldContainsBruceDickinsonAsChanteur() {
$this->assertXPathContentContains('//dl//dd//a',
$this->assertXPathContentContains('//dl//dd//a',
'Bruce Dickinson (Chanteur)',
$this->_response->getBody());
}
......@@ -375,7 +367,7 @@ class RechercheControllerAlbumAudioRecordViewRessourcesNumeriquesTest extends Re
$this->assertXPathContentContains('//ol//li', 'The prophecy');
}
/** @test */
public function pageShouldContainsLinkToXSPFPlayList() {
$this->assertXPath('//a[contains(@href,"/bib-numerique/album-xspf-playlist/id/4.xspf")]');
......@@ -396,7 +388,7 @@ class RechercheControllerAlbumAudioRecordViewRessourceInTelephoneModeTest extend
$this->dispatch('/opac/recherche/viewnotice/id/1', true);
}
/** @test */
public function pageShouldContainsLinkToOpenRessourcesNumeriques() {
$this->assertXPathContentContains('//a[contains(@href,"recherche/ressourcesnumeriques/id/1")]','Ecouter l\'album',$this->_response->getBody());
......
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