[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/eztemplate/ -> eztesttemplateoutput.php (source)

   1  <?php
   2  //
   3  // Definition of eZTestTemplateOutput class
   4  //
   5  // Created on: <30-Jan-2004 11:59:49 >
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file eztesttemplateoutput.php
  30  */
  31  
  32  /*!
  33    \class eZTestTemplateOutput eztesttemplateoutput.php
  34    \brief The class eZTestTemplateOutput does
  35  
  36  */
  37  
  38  class eZTestTemplateOutput extends eZTestCase
  39  {
  40      /*!
  41       Constructor
  42      */
  43      function eZTestTemplateOutput( $name = false )
  44      {
  45          $this->eZTestCase( $name );
  46          $this->addTest( 'testOutput', 'Compiled template output' );
  47          $this->addTest( 'testZero', 'Handling of zero elements' );
  48  //        $this->addTest( 'testImage', 'Testing creation of Images' );
  49      }
  50  
  51      function testImage( &$tr )
  52      {
  53          include_once ( 'kernel/common/template.php' );
  54          $tpl =& templateInit();
  55  
  56          $fp = fopen( 'tests/eztemplate/image.exp', 'rb' );
  57          $expected = fread( $fp, filesize( 'tests/eztemplate/image.exp' ) );
  58          fclose( $fp );
  59  
  60          $tpl->reset();
  61  
  62          eZTemplateCompiler::setSettings( array( 'compile' => true,
  63                                                  'comments' => false,
  64                                                  'accumulators' => false,
  65                                                  'timingpoints' => false,
  66                                                  'fallbackresource' => false,
  67                                                  'nodeplacement' => false,
  68                                                  'execution' => true,
  69                                                  'generate' => true,
  70                                                  'compilation-directory' => 'tests/eztemplate/compilation' ) );
  71          $actual = $tpl->fetch( 'tests/eztemplate/image.tpl' );
  72          $fp = fopen( 'tests/eztemplate/image.out', 'w' );
  73          fwrite( $fp, $actual );
  74          fclose( $fp );
  75  
  76          $tr->assert( $actual == $expected, 'String compare of results' );
  77      }
  78  
  79      function testOutput( &$tr )
  80      {
  81          include_once ( 'kernel/common/template.php' );
  82          $tpl =& templateInit();
  83  
  84          $tpl->setIsCachingAllowed( false );
  85          $tpl->setIsDebugEnabled( false );
  86          $expected = $tpl->fetch( 'tests/eztemplate/output.tpl' );
  87          $fp = fopen( 'tests/eztemplate/output.exp', 'w' );
  88          fwrite( $fp, $expected );
  89          fclose( $fp );
  90  
  91          $tpl->setIsCachingAllowed( true );
  92          $tpl->reset();
  93  
  94          $tpl->setIsDebugEnabled( false );
  95          eZTemplateCompiler::setSettings( array( 'compile' => true,
  96                                                  'comments' => false,
  97                                                  'accumulators' => false,
  98                                                  'timingpoints' => false,
  99                                                  'fallbackresource' => false,
 100                                                  'nodeplacement' => false,
 101                                                  'execution' => true,
 102                                                  'generate' => true,
 103                                                  'compilation-directory' => 'tests/eztemplate/compilation' ) );
 104          $actual = $tpl->fetch( 'tests/eztemplate/output.tpl' );
 105          $fp = fopen( 'tests/eztemplate/output.out', 'w' );
 106          fwrite( $fp, $actual );
 107          fclose( $fp );
 108  
 109          $tr->assert( $actual == $expected );
 110      }
 111  
 112      function testZero( &$tr )
 113      {
 114          include_once ( 'kernel/common/template.php' );
 115          $tpl =& templateInit();
 116  
 117          $tpl->setIsCachingAllowed( false );
 118          $expected = $tpl->fetch( 'tests/eztemplate/empty.tpl' );
 119  
 120          $actual = '0';
 121  
 122          $tr->assert( strcmp( $actual, $expected ) == 0, 'String compare of results' );
 123      }
 124  }
 125  
 126  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7