Skip to content
Snippets Groups Projects
Commit fdfe655c authored by Laurent's avatar Laurent
Browse files

dev #50182 reporting : add portal section

parent fea90024
Branches
Tags
5 merge requests!2080Sandbox detach zf from storm,!2061Master,!1975Master,!1972Dev#50182 1055 seaside meilleur reporting poker 1 generation du rapport html dans bokeh json,!1961Dev#50182 1055 seaside meilleur reporting poker 1 generation du rapport html dans bokeh json
- ticket #50182 : 10/55 Seaside : meilleur reporting poker 1 : génération du rapport HTML dans Bokeh + JSON
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2014, 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
*/
class ZendAfi_View_Helper_Status_Json extends ZendAfi_View_Helper_BaseHelper {
public function status_Json() {
return json_encode($this->_report());
}
protected function _report() {
return ['portal' => $this->_portal()];
}
protected function _portal() {
return [
'url' => Class_AdminVar::get('NOM_DOMAINE'),
'version' => BOKEH_RELEASE_NUMBER,
'label' => Class_Profil::getPortail()->getLibelle(),
'skins' => $this->_profilSkins()
];
}
protected function _profilSkins() {
return
array_values(
array_unique((new Storm_Model_Collection(Class_Profil::findTopProfils()))
->collect('skin')
->getArrayCopy()));
}
}
?>
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2014, 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
*/
class ZendAfi_View_Helper_Status_JsonTest extends ViewHelperTestCase {
protected
$_storm_default_to_volatile = true,
$_helper,
$_report;
protected function _setupBokeh() {
Class_AdminVar::set('NOM_DOMAINE', 'http://library.annecy.fr');
$this->fixture('Class_Profil',
['id' => 1,
'libelle' => 'C2A portal',
'parent_id' => null,
'skin' => 'beautiful']);
$this->fixture('Class_Profil',
['id' => 34,
'libelle' => 'Annecy',
'parent_id' => null,
'skin' => 'quiet_lake']);
$this->fixture('Class_Profil',
['id' => 35,
'libelle' => 'Annecy-Le-Vieux',
'parent_id' => null,
'skin' => 'quiet_lake']);
}
public function setUp() {
parent::setUp();
$view = new ZendAfi_Controller_Action_Helper_View();
$this->_helper = new ZendAfi_View_Helper_Status_Json();
$this->_helper->setView($view);
$this->_setupBokeh();
$this->_report = json_decode($this->_helper->status_Json(),true);
}
/** @test */
public function portalUrlShouldBeLibraryAnnecyDotFr() {
$this->assertEquals('http://library.annecy.fr', $this->_report['portal']['url']);
}
/** @test */
public function portalVersionShouldBeCurrentVersion() {
$this->assertEquals(BOKEH_RELEASE_NUMBER, $this->_report['portal']['version']);
}
/** @test */
public function portalLabelShouldBeC2APortal() {
$this->assertEquals('C2A portal', $this->_report['portal']['label']);
}
/** @test */
public function portalSkinsShouldContainsBeautifulAndQuietLake() {
$this->assertEquals(['quiet_lake', 'beautiful'], $this->_report['portal']['skins']);
}
}
?>
\ No newline at end of file
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