incubator-zeta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jero...@apache.org
Subject [zeta-commits] svn commit: r1153777 - /incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php
Date Thu, 04 Aug 2011 08:21:14 GMT
Author: jeromer
Date: Thu Aug  4 08:21:14 2011
New Revision: 1153777

URL: http://svn.apache.org/viewvc?rev=1153777&view=rev
Log:
- Added runExtractorCommand()

# I apologize for the "No new line at end of line" message
# I tried to fix this in Vim but nothing seems to work ....


Modified:
    incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php

Modified: incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php?rev=1153777&r1=1153776&r2=1153777&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php (original)
+++ incubator/zetacomponents/trunk/TemplateTranslationTiein/tests/extracter.php Thu Aug  4
08:21:14 2011
@@ -156,40 +156,46 @@ class ezcTemplateTranslationExtracterTes
 
     public function testRunNonEztTemplateExtension()
     {
-        $origArgv = $_SERVER['argv'];
         $tmpDir = sys_get_temp_dir();
         $testFileDir = "TemplateTranslationTiein/tests/test_files/extractor/templates/customtplextension";
         $tmpFile = "${tmpDir}/en.xml";
 
+        $this->runExtractorCommand( $testFileDir, 'tpl', $tmpDir );
+
+        $this->assertEquals(
+            file_get_contents( "${testFileDir}/output.xml" ),
+            file_get_contents( $tmpFile )
+        );
+
+        unlink( $tmpFile );
+    }
+
+    public static function suite()
+    {
+         return new PHPUnit_Framework_TestSuite( 'ezcTemplateTranslationExtracterTest' );
+    }
+
+    private function runExtractorCommand( $inputDir, $fileExt, $outputDir )
+    {
+        $origArgv = $_SERVER['argv'];
+
         ob_start();
         $extractor = new ezcTemplateTranslationExtractor();
 
         $_SERVER['argv'] = array (
             0 => 'TemplateTranslationTiein/src/runextractor.php',
             1 => '-t',
-            2 => $testFileDir,
+            2 => $inputDir,
             3 => '-e',
-            4 => 'tpl',
-            5 => $tmpDir,
+            4 => $fileExt,
+            5 => $outputDir,
         );
 
         $extractor->run();
         ob_end_clean();
 
         $_SERVER['argv'] = $origArgv;
-
-        $this->assertEquals(
-            file_get_contents( "${testFileDir}/output.xml" ),
-            file_get_contents( $tmpFile )
-        );
-
-        unlink( $tmpFile );
-    }
-
-    public static function suite()
-    {
-         return new PHPUnit_Framework_TestSuite( 'ezcTemplateTranslationExtracterTest' );
     }
 }
 
-?>
\ No newline at end of file
+?>



Mime
View raw message