Skip to content
Snippets Groups Projects
Commit 8cde2efc authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline#30747_cms_categories_with_same_id_and_parent_id' into 'stable'

Hotline#30747 cms categories with same id and parent

See merge request !1149
parents c1d18357 4cbd7179
Branches
Tags
No related merge requests found
- ticket #30747 : Correction de la possibilité de déclarer une catégorie d'article comme étant sa propre catégorie parente.
\ No newline at end of file
......@@ -70,6 +70,8 @@ class Class_ArticleCategorie extends Storm_Model_Abstract {
$filter = new Zend_Filter_StripTags();
$this->setLibelle(trim($filter->filter($this->getLibelle())));
if($this->getId() === $this->getIdCatMere())
$this->setIdCatMere(0);
}
......
......@@ -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
*/
class ArticleCategorieTest extends Storm_Test_ModelTestCase {
......@@ -82,7 +82,7 @@ class ArticleCategorieTest extends Storm_Test_ModelTestCase {
->answers(true)
->getWrapper();
$this->concert_truffaz = Class_Article::newInstanceWithId(23, ['id_cat' => 34,
'titre' => 'Concert Truffaz']);
......@@ -169,9 +169,9 @@ class ArticleCategorieTest extends Storm_Test_ModelTestCase {
}
/**
/**
* Régression vue sur Pontault
* @test
* @test
*/
public function annecyWithCarriageReturnToJSONShouldRemoveCR() {
$this->annecy->setLibelle("Annecy\n");
......@@ -317,11 +317,11 @@ JSON;
/** @test */
public function findByPathAdulteConcertsJazzShouldAnswerCategorieJazz() {
$this->assertEquals($this->cat_concerts_jazz,
$this->assertEquals($this->cat_concerts_jazz,
Class_ArticleCategorie::getRoot()->findByPath('/Adulte/Concerts/Jazz'));
}
/** @test **/
public function profilConcertPathAndCategorieConcertPathShouldBeEquals() {
$this->assertEquals($this->cat_concerts->getPath(), $this->concert_profil->getPath());
......@@ -334,4 +334,27 @@ JSON;
}
}
?>
\ No newline at end of file
class ArticleCategorieParentTest extends Storm_Test_ModelTestCase {
protected $_news;
public function setUp() {
parent::setUp();
$annecy = $this->fixture('Class_Bib',
['id' => 1,
'libelle' => 'Annecy']);
$this->_news = $this->fixture('Class_ArticleCategorie',
['id' => 5,
'id_cat_mere' => 5,
'libelle' => 'News']);
}
/** @test */
public function newsParentCategorieShouldBe0() {
$this->assertEquals('0', $this->_news->getIdCatMere());
}
}
\ 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