logo       

4081 - trunk/EventLog/tests/writers [eZComponents: Trunk]: msg#00254

web.ezcomponents.cvs

Subject: 4081 - trunk/EventLog/tests/writers [eZComponents: Trunk]

Author: Alexandru Stanoi
Date: 2006-11-27 14:14:42 +0100 (Mon, 27 Nov 2006)
New Revision: 4081

Log:
- Added a test for the fix for bug #9603, but commented out because warnings
are thrown.

Modified:
trunk/EventLog/tests/writers/writer_file_test.php

Modified: trunk/EventLog/tests/writers/writer_file_test.php
===================================================================
--- trunk/EventLog/tests/writers/writer_file_test.php 2006-11-27 13:09:47 UTC
(rev 4080)
+++ trunk/EventLog/tests/writers/writer_file_test.php 2006-11-27 13:14:42 UTC
(rev 4081)
@@ -18,6 +18,25 @@
$this->removeTempDir();
}

+/*
+ // This test was used to check for bug #9603, and it is commented out
because
+ // the code throws warnings for fwrite() and fclose()
+ public function testWriteNotDefault()
+ {
+ $log = ezcLog::getInstance();
+ $writer = new TempImplementation2($this->getTempDir(), 'broken.log');
+ try
+ {
+ $writer->writeLogMessage( 'xxx', 'c', 'd', '' );
+ //$log->log( null, ezcLog::INFO, array() );
+ $this->fail( 'Expected exception was not thrown' );
+ }
+ catch ( ezcLogWriterException $e )
+ {
+ }
+ }
+*/
+
// Check if can be written to the temporary file.
public function testSelf()
{
@@ -208,7 +227,24 @@
$this->write( $type, $source, $category, $res );
}
}
-

+class TempImplementation2 extends ezcLogFileWriter
+{
+ public function __construct($dir, $file = null, $maxSize = 1, $maxFiles =
1 )
+ {
+ parent::__construct($dir, $file, $maxSize, $maxFiles);
+ // close the open files in order to see if an exception is thrown
+ foreach ( $this->openFiles as $fh )
+ {
+ fclose( $fh );
+ }
+ }

+ public function writeLogMessage( $message, $type, $source, $category,
$extraInfo = array() )
+ {
+ $res = print_r( array( "message" => $message, "type" => $type,
"source" => $source, "category" => $category ), true );
+ $this->write( $type, $source, $category, $res );
+ }
+}
+
?>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise