Skip to content
Snippets Groups Projects
Commit 4af89016 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

hotline #23808 - fix tests

parent 111ae155
Branches
Tags
6 merge requests!1167Dev #23808 moderation reviews,!1154Sandbox ui reviews,!1151Hotline#23808 des avis sont affectes a des titres similaires,!1134Sandbox ui reviews,!1127Hotline#23808 des avis sont affectes a des titres similaires,!1125Hotline#23808 des avis sont affectes a des titres similaires
...@@ -438,7 +438,7 @@ class AbonneControllerAvisBlogControllerViewAuteurActionTest extends AvisControl ...@@ -438,7 +438,7 @@ class AbonneControllerAvisBlogControllerViewAuteurActionTest extends AvisControl
/** @test */ /** @test */
public function AvisWithoutNoticeShouldBeDisplayedForAuthor() { public function AvisWithoutNoticeShouldBeDisplayedForAuthor() {
$this->assertXPathContentContains("//div[@class='critique'][1]//a", 'Lost highway',$this->_response->getBody()); $this->assertXPathContentContains("//div[@class='critique'][1]//a", 'Lost highway');
} }
...@@ -448,18 +448,18 @@ class AbonneControllerAvisBlogControllerViewAuteurActionTest extends AvisControl ...@@ -448,18 +448,18 @@ class AbonneControllerAvisBlogControllerViewAuteurActionTest extends AvisControl
} }
public function testMilleniumIsHere() { public function testMilleniumIsHere() {
$this->assertXPathContentContains("//div[@class='critique'][2]//h2", 'Millenium (Stieg Larsson)',$this->_response->getBody()); $this->assertXPathContentContains("//div[@class='critique'][2]//h2", 'Millenium (Stieg Larsson)');
} }
/** @test */ /** @test */
public function milleniumShouldLinkToNoticeMilleniumWithRetourAbonneViewAvis() { public function milleniumShouldLinkToNoticeMilleniumWithRetourAbonneViewAvis() {
$this->assertXPath('//a[contains(@href, "/recherche/viewnotice/id/817/clef/MILLENIUM/retour_abonne/viewavis")]',$this->_response->getBody()); $this->assertXPath('//a[contains(@href, "/recherche/viewnotice/id/817/clef/MILLENIUM/retour_abonne/viewavis")]');
} }
public function testPotterIsHere() { public function testPotterIsHere() {
$this->assertXPathContentContains("//div[@class='critique'][3]//h2", 'Potter et la chambre des secrets',$this->_response->getBody()); $this->assertXPathContentContains("//div[@class='critique'][3]//h2", 'Potter et la chambre des secrets');
} }
public function testDeleteMilleniumButtonPresent() { public function testDeleteMilleniumButtonPresent() {
......
...@@ -367,7 +367,8 @@ class AvisTestFindAllByUserAndClefOeuvreTestCase extends AvisTestFindAllTestCase ...@@ -367,7 +367,8 @@ class AvisTestFindAllByUserAndClefOeuvreTestCase extends AvisTestFindAllTestCase
class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase { class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase {
public function setUp() { public function setUp() {
$this->millenium = Class_Notice::newInstanceWithId(34, ['clef_oeuvre' => 'MILLENIUM--LARSSON']); $this->millenium = $this->fixture('Class_Notice', ['id' => 34,
'clef_oeuvre' => 'MILLENIUM--LARSSON']);
$this->steve = Class_Users::newInstanceWithId(5, ['prenom' => 'Steve']); $this->steve = Class_Users::newInstanceWithId(5, ['prenom' => 'Steve']);
$this->avis_millenium_steve = $this->fixture('Class_AvisNotice', ['id' => 12, $this->avis_millenium_steve = $this->fixture('Class_AvisNotice', ['id' => 12,
...@@ -413,14 +414,8 @@ class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase { ...@@ -413,14 +414,8 @@ class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase {
/** @test */ /** @test */
public function avisMilleniumSteveGetNoticesShouldReturnNoticeMillenium() { public function avisMilleniumSteveGetNoticesShouldReturnNoticeMillenium() {
$this->notice_loader $notices_found = $this->avis_millenium_steve->findNoticesByClefOeuvre();
->whenCalled('findAllBy') $this->assertEquals(array($this->millenium), $notices_found);
->with(['clef_oeuvre' => 'MILLENIUM--LARSSON'])
->answers([$this->millenium]);
$this->avis_millenium_steve->findNoticesByClefOeuvre();
$notices_found = $this->avis_millenium_steve->getNotices();
$this->assertEquals(array($this->millenium),
$notices_found);
} }
...@@ -459,15 +454,6 @@ class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase { ...@@ -459,15 +454,6 @@ class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase {
public function avisLostShouldBeSaved($saved_avis) { public function avisLostShouldBeSaved($saved_avis) {
$this->assertEquals('MILLENIUM--LARSSON', $saved_avis->getClefOeuvre()); $this->assertEquals('MILLENIUM--LARSSON', $saved_avis->getClefOeuvre());
} }
/**
* @test
* @depends lostAvisMilleniumGetNoticesShouldSearchNoticeOnTitleClefOeuvre
*/
public function avisLostShouldGoThroughModeration($saved_avis) {
$this->assertEquals(0, $saved_avis->getStatut());
}
} }
...@@ -626,7 +612,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -626,7 +612,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->preferences['abon_ou_bib'] = 'all'; $this->preferences['abon_ou_bib'] = 'all';
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE ((STATUT=1 OR ABON_OU_BIB=0)) ". "WHERE (flags=0) AND ((STATUT=1 OR ABON_OU_BIB=0)) ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
...@@ -639,7 +625,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -639,7 +625,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE ((STATUT=1 OR ABON_OU_BIB=1) ". "WHERE (flags=0) AND ((STATUT=1 OR ABON_OU_BIB=1) ".
"AND (STATUT=1 OR ABON_OU_BIB=0)) ". "AND (STATUT=1 OR ABON_OU_BIB=0)) ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
...@@ -649,7 +635,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -649,7 +635,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->preferences['abon_ou_bib'] = '0'; $this->preferences['abon_ou_bib'] = '0';
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE (ABON_OU_BIB='0') ". "WHERE (flags=0) AND (ABON_OU_BIB='0') ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
...@@ -660,7 +646,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -660,7 +646,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->preferences['abon_ou_bib'] = '0'; $this->preferences['abon_ou_bib'] = '0';
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE (ABON_OU_BIB='0') ". "WHERE (flags=0) AND (ABON_OU_BIB='0') ".
"AND ((STATUT=1 OR ABON_OU_BIB=1)) ". "AND ((STATUT=1 OR ABON_OU_BIB=1)) ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
...@@ -670,7 +656,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -670,7 +656,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->preferences['abon_ou_bib'] = '1'; $this->preferences['abon_ou_bib'] = '1';
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE (ABON_OU_BIB='1') ". "WHERE (flags=0) AND (ABON_OU_BIB='1') ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
...@@ -680,7 +666,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase { ...@@ -680,7 +666,7 @@ class AvisLoaderGetAvisFromPreferencesTest extends AvisTestFindAllTestCase {
$this->preferences['abon_ou_bib'] = '1'; $this->preferences['abon_ou_bib'] = '1';
$this->assertQueryIs("SELECT `notices_avis`.* ". $this->assertQueryIs("SELECT `notices_avis`.* ".
"FROM `notices_avis` ". "FROM `notices_avis` ".
"WHERE (ABON_OU_BIB='1') ". "WHERE (flags=0) AND (ABON_OU_BIB='1') ".
"AND ((STATUT=1 OR ABON_OU_BIB=0)) ". "AND ((STATUT=1 OR ABON_OU_BIB=0)) ".
"ORDER BY `DATE_AVIS` DESC"); "ORDER BY `DATE_AVIS` DESC");
} }
......
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