Author: dr
Date: Mon Jan 21 10:13:02 2008
New Revision: 7195

Log:
- Implemented issue #10791: ezcConsoleTable should implement __toString.

Modified:
    trunk/ConsoleTools/ChangeLog
    trunk/ConsoleTools/src/table.php
    trunk/ConsoleTools/tests/table_test.php

Modified: trunk/ConsoleTools/ChangeLog
==============================================================================
--- trunk/ConsoleTools/ChangeLog [iso-8859-1] (original)
+++ trunk/ConsoleTools/ChangeLog [iso-8859-1] Mon Jan 21 10:13:02 2008
@@ -1,11 +1,11 @@
 1.4alpha1 - [RELEASEDATE]
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-- Implemented enhancement #010765: ezcConsoleQuestionDialog::YesNoQuestion
-  does not accept "Yes" or "yes" / "no", "No" as valid answer. A new validator
+- Implemented issue #10765: ezcConsoleQuestionDialog::YesNoQuestion does not
+  accept "Yes" or "yes" / "no", "No" as valid answer. A new validator
   (ezcConsoleQuestionMappingValidator) was introduced for this, which extends
-  ezcConsoleQuestionCollectionValidator and is now used for the
-  yes-no-question.
+  ezcConsoleQuestionCollectionValidator and is now used for the 
yes-no-question.
+- Implemented issue #10791: ezcConsoleTable should implement __toString.
 
 
 1.3.2 - Monday 14 January 2008

Modified: trunk/ConsoleTools/src/table.php
==============================================================================
--- trunk/ConsoleTools/src/table.php [iso-8859-1] (original)
+++ trunk/ConsoleTools/src/table.php [iso-8859-1] Mon Jan 21 10:13:02 2008
@@ -214,7 +214,8 @@
     }
 
     /**
-     * Returns the table in a string.
+     * Returns the table in an array.
+     *
      * Returns the entire table as an array of printable lines. Each element of
      * the array represents a physical line of the drawn table, including all
      * borders and stuff, so you can simply print the table using
@@ -239,6 +240,16 @@
     public function outputTable() 
     {
         echo implode( PHP_EOL, $this->generateTable() );
+    }
+
+    /**
+     * Returns the table in a string.
+     *
+     * @return void
+     */
+    public function __toString()
+    {
+        return implode( PHP_EOL, $this->generateTable() );
     }
 
     /**

Modified: trunk/ConsoleTools/tests/table_test.php
==============================================================================
--- trunk/ConsoleTools/tests/table_test.php [iso-8859-1] (original)
+++ trunk/ConsoleTools/tests/table_test.php [iso-8859-1] Mon Jan 21 10:13:02 
2008
@@ -998,13 +998,18 @@
         $refFile = dirname( __FILE__ ) . '/data/' . ( ezcBaseFeatures::os() 
=== "Windows" ? "windows/" : "posix/" ) . $refFile . '.dat';
         // To prepare test files, uncomment this block
         // file_put_contents( $refFile, implode( PHP_EOL, $table->getTable() ) 
);
-        
+
         // For test assertion, uncomment this block
         $this->assertEquals(
             file_get_contents( $refFile ),
             implode( PHP_EOL, $table->getTable() ),
             'Table not correctly generated for ' . $refFile . '.'
         );
+        $this->assertEquals(
+            file_get_contents( $refFile ),
+            (string) $table,
+            'Table not correctly generated for ' . $refFile . '.'
+        );
 
     }
 }


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to