Changeset 2962

Show
Ignore:
Timestamp:
07/24/08 19:42:45 (1 month ago)
Author:
alexandrej
Message:

Mise à jour sur les tests unitaires

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingelementinformationtest.class.php

    r2951 r2962  
    2323    } 
    2424     
     25    /** 
     26     * Teste la recherche de la future version d'un element 
     27     * 
     28     */ 
    2529    public function testGetNextVersion () { 
    26         $this->assertTrue(_class('heading|HeadingElementInformationServices')->getNextVersion(37) === 1); 
     30        $this->assertTrue(_class('heading|HeadingElementInformationServices')->getNextVersion(20) === 1); 
    2731    } 
    2832     
    29     public function testDeleteById () { 
    30         CopixDb::getConnection()->doQuery("INSERT INTO `headingelementinformation` (`id_hei`, `id_helt`, `type_hei`, `public_id_hei`, `site_id_hei`, `parent_heading_public_id_hei`, `author_id_create_hei`, `author_handler_create_hei`, `author_caption_create_hei`, `date_create_hei`, `author_id_update_hei`, `author_handler_udpate_hei`, `author_caption_update_hei`, `date_update_hei`, `comment_hei`, `caption_hei`, `published_date_hei`, `end_published_date_hei`, `status_hei`, `version_hei`, `from_version_hei`, `show_in_menu_hei`, `base_url_hei`, `url_id_hei`, `public_id_root_menu_hei`, `public_id_contextual_menu_hei`, `theme_id_hei`) VALUES 
    31 (1, 10, 'heading', 1, 'principal', 0, NULL, NULL, NULL, '2008-07-23 16:46:24', NULL, NULL, NULL, '2008-07-23 16:46:24', NULL, 'Rubrique testée 20080723164624', NULL, NULL, '3', 0, 0, 0, NULL, NULL, NULL, NULL, NULL)"); 
    32         $this->assertTrue (_class('heading|HeadingElementInformationServices')->deleteById(1950) !== false); 
     33    /** 
     34     * Procédure de création d'une arborescence 
     35     * 
     36     * @return unknown 
     37     */ 
     38    public function testCreationArbo (){ 
     39        $r1 = _ppo (array ('parent_heading_public_id_hei'=>0, 
     40                            'caption_hei'=>'R1' 
     41                    )); 
     42        _class ('heading|headingservices')->insert ($r1); 
     43 
     44        $r2 = _ppo (array ('parent_heading_public_id_hei'=>0, 
     45                            'caption_hei'=>'R2' 
     46                    )); 
     47        _class ('heading|headingservices')->insert ($r2); 
     48 
     49        $r3 = _ppo (array ('parent_heading_public_id_hei'=>0, 
     50                            'caption_hei'=>'R3' 
     51                    )); 
     52        _class ('heading|headingservices')->insert ($r3); 
     53 
     54        $r11 = _ppo (array ('parent_heading_public_id_hei'=>$r1->public_id_hei, 
     55                            'caption_hei'=>'R11' 
     56                    )); 
     57        _class ('heading|headingservices')->insert ($r11);       
     58 
     59        $r12 = _ppo (array ('parent_heading_public_id_hei'=>$r1->public_id_hei, 
     60                            'caption_hei'=>'R12' 
     61                    )); 
     62        _class ('heading|headingservices')->insert ($r12);       
     63         
     64        $r121 = _ppo (array ('parent_heading_public_id_hei'=>$r12->public_id_hei, 
     65                            'caption_hei'=>'R121' 
     66                    )); 
     67        _class ('heading|headingservices')->insert ($r121); 
     68 
     69        $r122 = _ppo (array ('parent_heading_public_id_hei'=>$r12->public_id_hei, 
     70                            'caption_hei'=>'R122', 
     71                            'description_head'=>'Description de la rubrique 122' 
     72                    )); 
     73        _class ('heading|headingservices')->insert ($r122); 
     74 
     75        return compact ('r1', 'r2', 'r3', 'r11', 'r12', 'r121'); 
    3376    } 
    3477     
     78    /** 
     79     * Teste la suppression d'un element à partir de son identifiant et de son type 
     80     * 
     81     */ 
     82    public function testDeleteById () { 
     83        $this->assertTrue (_class('heading|HeadingElementInformationServices')->deleteById(15, true) !== false); 
     84        $this->testCreationArbo();       
     85    } 
     86     
     87    /** 
     88     * Teste la suppression d'un element à partir de son identifiant public 
     89     * 
     90     */ 
    3591    public function testDeleteByPublicId () { 
    36         CopixDb::getConnection()->doQuery("INSERT INTO `headingelementinformation` (`id_hei`, `id_helt`, `type_hei`, `public_id_hei`, `site_id_hei`, `parent_heading_public_id_hei`, `author_id_create_hei`, `author_handler_create_hei`, `author_caption_create_hei`, `date_create_hei`, `author_id_update_hei`, `author_handler_udpate_hei`, `author_caption_update_hei`, `date_update_hei`, `comment_hei`, `caption_hei`, `published_date_hei`, `end_published_date_hei`, `status_hei`, `version_hei`, `from_version_hei`, `show_in_menu_hei`, `base_url_hei`, `url_id_hei`, `public_id_root_menu_hei`, `public_id_contextual_menu_hei`, `theme_id_hei`) VALUES 
    37         (1, 10, 'heading', 1, 'principal', 0, NULL, NULL, NULL, '2008-07-23 16:46:24', NULL, NULL, NULL, '2008-07-23 16:46:24', NULL, 'Rubrique testée 20080723164624', NULL, NULL, '3', 0, 0, 0, NULL, NULL, NULL, NULL, NULL)"); 
    38         $this->assertTrue (_class('heading|HeadingElementInformationServices')->deleteByPublicId (1)); 
     92        $this->testCreationArbo();       
     93        $this->assertTrue (_class('heading|HeadingElementInformationServices')->deleteByPublicId (16, true) !== false); 
     94    } 
     95     
     96    /** 
     97     * Teste si un element à un fils à partir de son identifiant et de son type 
     98     * 
     99     */ 
     100    public function testHasChild() { 
     101        $this->assertTrue(_class('heading|HeadingElementInformationServices')->hasChild (17, 'heading') == true); 
     102    } 
     103 
     104    /** 
     105     * Teste si un element à un fils à partir de son identifiant public 
     106     * 
     107     */ 
     108    public function testHasChildById () { 
     109        $this->assertTrue(_class('heading|HeadingElementInformationServices')->hasChildById (31, 'heading') == true); 
     110    } 
     111     
     112    /** 
     113     * test sur l'accesseur de theme à partir de l'identifiant et du type 
     114     * 
     115     */ 
     116    public function testGetTheme () { 
     117        $arData = array ('theme' => 0, 'providedBy' => 6); 
     118        if (_class('heading|HeadingElementInformationServices')->getTheme (15) == $arData) { 
     119            $this->assertTrue(_class('heading|HeadingElementInformationServices')->getTheme (6) == $arData); 
     120        } 
     121    } 
     122     
     123    /** 
     124     * test sur l'accesseur de theme à partir de l'identifiant public 
     125     * 
     126     */ 
     127    public function testGetThemeById () { 
     128        $this->assertTrue(_class('heading|HeadingElementInformationServices')->getThemeById (2) !== false); 
     129    } 
     130     
     131    /** 
     132     * test sur l'url de base à partir de l'identifiant et du type 
     133     * 
     134     */ 
     135    public function testGetBaseUrl () { 
     136        $this->assertTrue (_class('heading|HeadingElementInformationServices')->getBaseUrl (4) == null); 
     137    } 
     138     
     139    /** 
     140     * test sur l'url de base à partir de l'identifiant public 
     141     * 
     142     */ 
     143    public function testGetBaseUrlById () { 
     144        $this->assertTrue (_class('heading|HeadingElementInformationServices')->getBaseUrlById (4) == null); 
     145    } 
     146     
     147    /** 
     148     * test sur le retour d'un root menu à partir de l'identifiant et du type 
     149     * 
     150     */ 
     151    public function testGetRootMenu () { 
     152        $this->assertTrue (_class('heading|HeadingElementInformationServices')->getRootMenu (4) == null); 
     153    } 
     154     
     155    /** 
     156     * Test sur le retour d'un root menu à partir de l'identifiant public 
     157     * 
     158     */ 
     159    public function testGetRootMenuById () { 
     160        $this->assertTrue (_class('heading|HeadingElementInformationServices')->getRootMenuById (4) == null); 
     161    } 
     162     
     163    /** 
     164     * Test sur le retour d'un menu contextuel 
     165     * 
     166     */ 
     167    public function testGetContextualMenu () { 
     168        $this->asserttrue (_class('heading|HeadingElementInformationServices')->getRootMenuById (4) == null); 
    39169    } 
    40170