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