Changeset 2949

Show
Ignore:
Timestamp:
07/23/08 18:46:32 (1 month ago)
Author:
alexandrej
Message:

Mise à jour des classes, et des tests unitaires pour le nouveau modèle de données

Files:

Legend:

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

    r2945 r2949  
    159159                               ->orderby (array('version_hei', 'DESC')) 
    160160                               ->setLimit (0, 1); 
    161         if (count ($results = _dao('headingelementinformation')->findBy ($parameters)) <= 1)
     161        if (!$results = _dao('headingelementinformation')->findBy ($parameters))
    162162            throw new CopixException ('Element inexistant '.$pPublicId); 
    163163        } 
  • trunk/project/modules/devel/cms3/heading/classes/headingelementtype.class.php

    r2942 r2949  
    1010class HeadingElementType { 
    1111     
    12      static public function getList() { 
     12     public function getList() { 
    1313        CopixClassesFactory::fileInclude ('heading|headingparameterservices'); 
    14         $config = CopixConfig::instance(); 
    15         $config->force_compile = true; 
    1614        $xml = CopixModule::getParsedModuleInformation ( 
    1715                            "headingList_ParameterGroups", 
     
    2725     * @return string libellé 
    2826     */ 
    29     static public function getCaption ($id) { 
     27    public function getCaption ($id) { 
    3028        $arData = self::getList($id); 
    3129        return $arData[$id]; 
  • trunk/project/modules/devel/cms3/heading/classes/headingservices.class.php

    r2945 r2949  
    5959                                   ->setLimit (0, 1); 
    6060            $results = _dao('heading')->findBy ($parameters); 
    61             if ($results[0]->parent_id_head !== null) { 
    62                 $record = _dao('heading')->get ($results[0]->parent_id_head); 
     61            if ($results[0]->public_id_hei !== null) { 
     62                $record = _dao('heading')->get ($results[0]->public_id_hei); 
     63                if ($record === false) { 
     64                    break; 
     65                } 
    6366                $path[] = $record->public_id_hei; 
    6467                $public_id = $record->public_id_hei; 
     
    6669                break; 
    6770            } 
    68         } while ($results[0]->parent_id_head); 
    69         return $path; 
     71        } while ($results[0]->public_id_hei); 
     72        //return $path; 
    7073    } 
    7174 
     
    8487            do { 
    8588                $results = _dao('heading')->get ($id_head); 
    86                 if ($results->parent_id_head !== null) { 
    87                     $path[] = $results->parent_id_head
    88                     $id_head = $results->parent_id_head
     89                if (isset($results->public_id_hei)) { 
     90                    $path[] = $results->public_id_hei
     91                    $id_head = $results->public_id_hei
    8992                } else { 
    9093                    break; 
    9194                } 
    92             } while ($results->parent_id_head); 
     95            } while ($results->public_id_hei); 
    9396        return $path; 
    9497    } 
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingelementinformationtest.class.php

    r2936 r2949  
    2424     
    2525    public function testgetNextVersion () { 
    26         CopixClassesFactory::fileInclude('heading|headingelementinformationservices'); 
    27         $this->assertTrue(HeadingElementInformationServices::getNextVersion(1) == 4); 
     26        $this->assertTrue(_class('heading|HeadingElementInformationServices')->getNextVersion(37) === 1); 
    2827    } 
    2928     
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingelementtype.class.php

    r2914 r2949  
    1010class heading_headingelementtype extends CopixTest { 
    1111    public function testParsingType () { 
    12         CopixClassesFactory::fileInclude('heading|HeadingElementType'); 
    13         $this->assertTrue(HeadingElementType::getCaption('media') === 'salut'); 
     12        $this->assertTrue(_class('heading|HeadingElementType')->getCaption('media') === 'salut'); 
    1413    } 
    1514     
    1615    public function testArrayType () { 
    17         CopixClassesFactory::fileInclude('heading|HeadingElementType'); 
    1816        $arData = array (); 
    1917        $arData['media'] = 'salut'; 
    2018        $arData['image'] = 'bonjour'; 
    21         $this->assertTrue(HeadingElementType::getList() == $arData); 
     19        $this->assertTrue(_class('heading|HeadingElementType')->getList() == $arData); 
    2220    } 
    2321} 
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingportletsxmlparse.class.php

    r2936 r2949  
    99 */ 
    1010class heading_headingportletsxmlparse extends CopixTest { 
    11     public function testParsingType () { 
    12         CopixClassesFactory::fileInclude('heading|headingservices'); 
    13         $this->assertTrue(HeadingServices::getZoneId('media') === 'salut'); 
    14     } 
    1511     
    1612    public function testArrayType () { 
    17         CopixClassesFactory::fileInclude('head'); 
    1813        $arData = array (); 
    19         $arData['diaporama'] = 'libelle sans i18n'; 
    20         $arData['document'] = 'cheminI18N'; 
    21         $this->assertTrue(HeadingElementType::getList() == $arData); 
     14        $arData['media'] = 'salut'; 
     15        $arData['image'] = 'bonjour'; 
     16        $this->assertTrue(_class('heading|HeadingElementType')->getList() == $arData); 
    2217    } 
    2318} 
  • trunk/project/modules/devel/cms3/heading/tests/heading_headingservicestest.class.php

    r2942 r2949  
    1414     */ 
    1515    public function testGetPathFromId () { 
    16         CopixClassesFactory::fileInclude('heading|headingservices'); 
    17         $this->assertTrue(HeadingServices::getPathFromId (8) !== null); 
     16        $this->assertTrue(_class('heading|headingservices')->getPathFromId (8) !== null); 
    1817    } 
    1918     
     
    2221     * 
    2322     */ 
    24     public function testGetPathFromPublicId () { 
    25         CopixClassesFactory::fileInclude('heading|headingservices'); 
    26         $this->assertTrue(HeadingServices::getPathFromPublicId (85) !== null); 
     23    public function testGetPathFromPublicId () {     
     24        $this->assertTrue(!_class('heading|headingservices')->getPathFromPublicId (5)); 
    2725    } 
    2826} 
  • trunk/project/modules/devel/cms3/portal/classes/portletservices.class.php

    r2941 r2949  
    88 * @license    http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 
    99 */ 
    10 class portletservices { 
     10class PortletServices { 
    1111     
    1212    /** 
     
    2929    public function getList () { 
    3030        CopixClassesFactory::fileInclude ('portal|portalparameterservices'); 
    31         $config = CopixConfig::instance(); 
    32         $config->force_compile = true; 
    3331        $xml = CopixModule::getParsedModuleInformation ( 
    3432                            "portallist_ParameterGroups", 
  • trunk/project/modules/devel/cms3/portal/tests/portal_portletsxmlparse.class.php

    r2919 r2949  
    1414    public function testParsingPortlet () { 
    1515        CopixClassesFactory::fileInclude('portal|portletservices'); 
    16         $this->assertTrue(PortletServices::getZoneId('diaporama') === 'libelle sans i18n'); 
     16        $this->assertTrue(_class('portal|portletservices')->getZoneId('diaporama') === 'libelle sans i18n'); 
    1717    } 
    1818