[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/test/tests/config/ -> properties_test.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/config/properties.class.php" );        
   5  
   6      /**
   7       * \ingroup Test
   8       *
   9       * Test cases for the Properties class
  10       */
  11      class Properties_Test extends LifeTypeTestCase
  12      {
  13          var $p;
  14          
  15  		function setUp()
  16          {
  17              $this->p = new Properties();
  18              $this->p->setValue( "test", "<b>this</b> has some <h1>HTML</h1> in it!" );
  19          }
  20          
  21          /**
  22           * Tests the Properties::getValue() method using a filter class as a third
  23           * parameter
  24           */
  25  		function testGetValueWithFilterClass()
  26          {
  27              // when not using a filter class, we should get the value as is
  28              $this->assertEquals( "<b>this</b> has some <h1>HTML</h1> in it!", $this->p->getValue( "test" ));
  29              
  30              // when using a filter class, the value should be returned filtered
  31              lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
  32              $this->assertEquals( "this has some HTML in it!", $this->p->getValue( "test", null, new HtmlFilter()));
  33          }
  34          
  35  		function testRegisterFilter()
  36          {
  37              // when not using a filter class, we should get the value as is
  38              $this->assertEquals( "<b>this</b> has some <h1>HTML</h1> in it!", $this->p->getValue( "test" ));            
  39              
  40              // now register a filter for this key and check that the output is filtered
  41              $this->p->registerFilter( "test", new HtmlFilter());
  42              $this->assertEquals( "this has some HTML in it!", $this->p->getValue( "test" ));
  43          }
  44      }
  45  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics