[ 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/file/unpacker/ -> zipunpacker_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/file/unpacker/zipunpacker.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
   6      
   7      define( "PCLZIP_TEST_FILE", PLOG_CLASS_PATH."class/test/tests/file/unpacker/pclziptest.zip" );
   8  
   9      /**
  10       * \ingroup Test
  11       *
  12       * Test case for the PCLZip library, used by the ZipUnpacker class
  13       */
  14      class ZipUnpacker_Test extends LifeTypeTestCase
  15      {
  16  		function setUp()
  17          {
  18              // make sure that our test file is there
  19              if( !File::isReadable( PCLZIP_TEST_FILE ))
  20                  die( "Can't continue with ZipUnpacker_Test: Please make sure that ".PCLZIP_TEST_FILE." is available" );
  21                  
  22              $this->u = new ZipUnpacker();
  23          }
  24          
  25  		function testMissingFile()
  26          {
  27              $this->assertFalse( $this->u->unpackNative( "whatever", "./anyfolder" ));
  28          }
  29          
  30  		function testUnpack()
  31          {
  32              // create a temporary folder and unzip the file there
  33              $config =& Config::getConfig();
  34              
  35              $tmpFolder = $config->getTempFolder()."/".md5(time());
  36              File::createDir( $tmpFolder );
  37              $this->assertTrue( $this->u->unpackNative( PCLZIP_TEST_FILE, $tmpFolder ));
  38              
  39              // check that the two files exist and are readable
  40              $this->assertTrue( File::isReadable( $tmpFolder."/test.txt" ));
  41              $this->assertTrue( File::isReadable( $tmpFolder."/test2.txt" ));
  42          }
  43      }
  44  ?>


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