Commit 7f5008bb authored by Patrick Barroca's avatar Patrick Barroca 😠

Merge branch 'hotline#25564_wrong_moderations_stats' into 'stable'

Hotline#25564 wrong moderations stats

See merge request !1070
parents 363174dd 5d61def7
- ticket #25564 : Corrige la manière dont sont calculés les statistiques de modération
\ No newline at end of file
......@@ -85,16 +85,16 @@ class Class_Moderer {
if (!isset($this->_moderation_stats)) {
$moderations = ['avis_notices' => ['label' => $translate->_('Avis sur les notices'),
'url' => BASE_URL . '/admin/modo/avisnotice',
'count' => fetchOne('select count(*) from notices_avis where STATUT = 0')],
'count' => Class_AvisNotice::countBy(['statut' => 0])],
'avis_articles' => ['label' => $translate->_('Avis sur les articles'),
'url' => BASE_URL . '/admin/modo/aviscms',
'count' => fetchOne('select count(*) from cms_avis where STATUT = 0')],
'count' => Class_Avis::countBy(['statut' => 0])],
'tags_notices' => ['label' => $translate->_('Tags sur les notices'),
'url' => BASE_URL . '/admin/modo/tagnotice',
'count' => fetchOne('select count(*) from codif_tags where a_moderer > \'\'')],
'count' => count((new Class_Moderer())->getAllTagsAModerer())],
'demandes_inscription' => ['label' => $translate->_('Demandes d\'inscription'),
'url' => BASE_URL . '/admin/modo/membreview',
'count' => fetchOne('select count(*) from bib_admin_users_non_valid')],
'count' => Class_UsersNonValid::count()],
'suggestions_achat' => ['label' => $translate->_('Suggestions d\'achat'),
'url' => BASE_URL . '/admin/modo/suggestion-achat',
'count' => Class_SuggestionAchat::count()],
......
......@@ -22,8 +22,59 @@ require_once realpath(dirname(__FILE__)) . '/AdminAbstractControllerTestCase.php
class ModoControllerIndexActionTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_AdminVar::set('AVIS_MIN_SAISIE', 2);
Class_AdminVar::set('AVIS_MAX_SAISIE', 2000);
$this->fixture('Class_Notice', ['id' => 1002,
'titre_principal' => 'Para Ana']);
$this->fixture('Class_Notice', ['id' => 1003,
'titre_principal' => 'Maison de la Nuit (La)']);
$this->fixture('Class_CodifTags', ['id' => 1,
'a_moderer' => '1002',
'libelle' => 'litteratures espagnol',
'code_alpha' => 'LITTERATURES ESPAGNOL']);
$this->fixture('Class_CodifTags', ['id' => 2,
'a_moderer' => '1002;1003',
'libelle' => 'muerto',
'code_alpha' => 'LITTERATURES ESPAGNOL']);
$this->fixture('Class_Avis', ['id' => 1,
'id_notice' => 1002,
'statut' => 0]);
$this->fixture('Class_AvisNotice', ['id' => 1,
'id_notice' => 1002,
'entete' => 'Mon avis',
'avis' => 'Ce livre est vraiment bien !',
'statut' => 0]);
$this->fixture('Class_SuggestionAchat', ['id' => 92,
'titre' => 'Kikolol',
'auteur' => 'Moi',
'isbn' => '',
'description_url' => 'http://livre.com/1',
'type_doc_id' => 1]);
$this->fixture('Class_UsersNonValid', ['id_user' => 8,
'id' => 8,
'login' => 'moo',
'password' => 'moo',
'mail' => 'moo@moo.com',]);
$this->fixture('Class_UsersNonValid', ['id_user' => 9,
'id' => 9,
'login' => 'Simon',
'password' => 'LeHerisson',
'mail' => 'simon-le-herisson@gmail.com',]);
$this->dispatch('admin/modo/', true);
}
......@@ -40,28 +91,64 @@ class ModoControllerIndexActionTest extends Admin_AbstractControllerTestCase {
}
/** @test */
public function linkToModerateMembershipShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/modo/membreview")]');
}
/** @test */
public function numberOfModerateMembreshipShouldBeTwo() {
$this->assertXPathContentContains('//span[@class="menu_info"][preceding::a[contains(@href, "/modo/membreview")]]', '2');
}
/** @test */
public function linkToModerateAvisCmsShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/modo/aviscms")]');
}
/** @test */
public function numberOfAvisCmsShouldBeOne() {
$this->assertXPathContentContains('//span[@class="menu_info"][preceding::a[contains(@href, "/modo/aviscms")]]', '1');
}
/** @test */
public function linkToModerateAvisNoticeShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/modo/avisnotice")]');
}
/** @test */
public function numberOfAvisNoticeShouldBeOne() {
$this->assertXPathContentContains('//span[@class="menu_info"][preceding::a[contains(@href, "/modo/avisnotice")]]', '1');
}
/** @test */
public function linkToModerateTagsShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/modo/tagnotice")]');
}
/** @test */
public function numberOfModerateTagsShouldBeThree() {
$this->assertXPathContentContains('//span[@class="menu_info"][preceding::a[contains(@href, "/modo/tagnotice")]]', '3');
}
/** @test */
public function linkToModerateSuggestionAchatShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/admin/modo/suggestion-achat")]');
}
/** @test */
public function numberOfModerateSuggestionAchatShouldBeOne() {
$this->assertXPathContentContains('//span[@class="menu_info"][preceding::a[contains(@href, "/modo/suggestion-achat")]]', '1');
}
}
......
Markdown is supported
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