Changeset 67

Show
Ignore:
Timestamp:
01/29/06 19:12:35 (3 years ago)
Author:
laurentj
Message:

ajout de la lib simpletest, et utilisation de simpletest dans testapp

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/testapp/modules/unittest/actiongroups/default.ag.php

    r55 r67  
    1515   function getDefault() { 
    1616      $rep = $this->getResponse('accueil'); 
    17       $rep->bodyTpl = 'accueil'; 
    1817      $rep->title = 'test unitaires'; 
     18      $rep->body->assign('MAIN',''); 
    1919      return $rep; 
    2020   } 
     
    2525   function getTestEvents (){ 
    2626      $rep = $this->getResponse('event'); 
    27       $rep->bodyTpl = ''; 
    2827      $rep->title = 'test unitaires sur jEvent'; 
    2928 
    30       $content='<p>Premier �nement : '; 
     29      $ut = jClasses::create("unittestservice"); 
     30      $ut->init($rep); 
     31      $ut->eventsTest(); 
    3132 
    32       $response = jEvent::notify('TestEvent'); 
    33       $response = $response->getResponse (); 
    34       $response = serialize($response[0]); 
    35       $temoin = serialize(array('module'=>'unittest','ok'=>true)); 
    36       if($temoin == $response) 
    37           $content .='r�nse ok</p>'; 
    38       else{ 
    39           $content .='r�nse mauvaise.</p><pre>'; 
    40           ob_start(); 
    41           var_dump($response); 
    42           $content.= ob_get_contents(); 
    43           ob_end_clean(); 
    44           $content.='</pre><p>R�nse attendue :</p><pre>'; 
    45           ob_start(); 
    46           var_dump($temoin); 
    47           $content.= ob_get_contents(); 
    48           ob_end_clean(); 
    49           $content .='</pre>'; 
    50       } 
    51       $content.='<hr /><p>Deuxi� �nement : '; 
    52  
    53       $temoin = array('hello'=>'world'); 
    54       $response = jEvent::notify('TestEventWithParams',$temoin ); 
    55  
    56       $response = $response->getResponse (); 
    57       /*$response = serialize($response[0]['params']); 
    58       $temoin = serialize($temoin);*/ 
    59       if($response[0]['params'] == 'world') 
    60           $content .='r�nse ok</p>'; 
    61       else{ 
    62           $content .='r�nse mauvaise.</p><pre>'; 
    63           ob_start(); 
    64           var_dump($response); 
    65           $content.= ob_get_contents(); 
    66           ob_end_clean(); 
    67           $content.='</pre><p>R�nse attendue :</p><pre>'; 
    68           ob_start(); 
    69           var_dump($temoin); 
    70           $content.= ob_get_contents(); 
    71           ob_end_clean(); 
    72           $content .='</pre>'; 
    73       } 
    74  
    75       $rep->addTopOfBody($content); 
    7633      return $rep; 
    7734   } 
  • trunk/testapp/modules/unittest/actions.xml

    r55 r67  
    44   <request type="classic"> 
    55      <action name="default" ag="default" method="getDefault" > 
    6           <response default="true" name="accueil" type="html" /> 
     6         <response default="true" name="accueil" type="unittest" /> 
    77      </action> 
    88 
    99      <action name="testevent" ag="default" method="getTestEvents" > 
    10           <response default="true" name="event" type="html" /> 
     10         <response default="true" name="event" type="unittest" /> 
    1111      </action> 
    1212 
    1313      <action name="urlsigparse" ag="urlsig" method="getTestParsing" > 
    14          <response default="true" name="default" type="html" /> 
     14         <response default="true" name="default" type="unittest" /> 
    1515      </action> 
    1616 
    1717      <action name="urlsigcreate" ag="urlsig" method="getTestCreate" > 
    18          <response default="true" name="default" type="html" /> 
     18         <response default="true" name="default" type="unittest" /> 
    1919      </action> 
    2020 
    2121      <action name="url1" ag="urlsig" method="getDummyUrl" > 
    22          <response default="true" name="default" type="html" /> 
     22         <response default="true" name="default" type="unittest" /> 
    2323      </action> 
    2424      <action name="url2" ag="urlsig" method="getDummyUrl" > 
    25          <response default="true" name="default" type="html" /> 
     25         <response default="true" name="default" type="unittest" /> 
    2626      </action> 
    2727      <action name="url3" ag="urlsig" method="getDummyUrl" > 
    28          <response default="true" name="default" type="html" /> 
     28         <response default="true" name="default" type="unittest" /> 
    2929      </action> 
    3030      <action name="url4" ag="urlsig" method="getDummyUrl" > 
    31          <response default="true" name="default" type="html" /> 
     31         <response default="true" name="default" type="unittest" /> 
    3232      </action> 
    3333      <action name="url5" ag="urlsig" method="getDummyUrl" > 
    34          <response default="true" name="default" type="html" /> 
     34         <response default="true" name="default" type="unittest" /> 
    3535      </action> 
    3636 
  • trunk/testapp/modules/unittest/templates/accueil.tpl

    r55 r67  
    1 <h2>Test unitaires</h2
     1<h1>Test unitaires sur Jelix</h1
    22 
    3 <h3>Events</h3> 
     3 
     4<div id="menu"> 
     5 
     6<h3>jEvent</h3> 
    47<ul> 
    58    <li><a href="?module=unittest&amp;action=testevent">lancer deux �nements</a></li> 
    69 
    710</ul> 
    8  
    9 <h3>jUrl et Urls significatifs</h3> 
     11<!-- 
     12<h3>jUrl</h3> 
    1013<ul> 
    1114    <li><a href="?module=unittest&amp;action=urlsigcreate">Tester la cr�ion d'url</a></li> 
    1215    <li><a href="?module=unittest&amp;action=urlsigparse">Tester l'analyse d'url</a></li> 
    1316</ul> 
     17--> 
     18</div> 
     19 
     20<div id="content"> 
     21{$MAIN} 
     22 
     23</div> 
  • trunk/testapp/responses/myHtmlResponse.class.php

    r60 r67  
    33/** 
    44* @package     jelix 
    5 * @subpackage  myapp 
     5* @subpackage  testapp 
    66* @version     $Id$ 
    77* @author      Jouanneau Laurent 
     
    1818 
    1919   public $bodyTpl = 'testapp~main'; 
    20     public $bodyErrorTpl = 'testapp~error'; 
     20   public $bodyErrorTpl = 'testapp~error'; 
    2121 
    22  
    23  
    24     // �urcharger dans les classes h�ti�s 
    25     protected function _commonProcess(){ 
    26  
     22   // modifications communes aux actions utilisant cette reponses 
     23   protected function _commonProcess(){ 
    2724       $this->title .= ($this->title !=''?' - ':'').' My Test App !'; 
    28     } 
    29  
    30  
     25   } 
    3126} 
    3227?> 
  • trunk/testapp/var/config/config.classic.ini.php.dist

    r60 r67  
    2525[responses] 
    2626html = myHtmlResponse 
     27unittest = testUnitResponse 
    2728 
    2829[error_handling] 
Download in other formats: Unified Diff Zip Archive