cvs: pear /PHPUnit/Extensions/Logger XML.php
| From: | Sebastian Bergmann | Date: | Sun, 04 Jan 2004 10:56:02 +0000 |
| Subject: | cvs: pear /PHPUnit/Extensions/Logger XML.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-15336@lists.php.net to get a copy of this message | ||
sebastian Sun Jan 4 05:56:02 2004 EDT
Modified files:
/pear/PHPUnit/Extensions/Logger XML.php
Log:
Change constructor to accept a stream resource.
Index: pear/PHPUnit/Extensions/Logger/XML.php
diff -u pear/PHPUnit/Extensions/Logger/XML.php:1.5 pear/PHPUnit/Extensions/Logger/XML.php:1.6
--- pear/PHPUnit/Extensions/Logger/XML.php:1.5 Thu Jan 1 05:31:41 2004
+++ pear/PHPUnit/Extensions/Logger/XML.php Sun Jan 4 05:56:02 2004
@@ -12,7 +12,7 @@
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
//
-// $Id: XML.php,v 1.5 2004/01/01 10:31:41 sebastian Exp $
+// $Id: XML.php,v 1.6 2004/01/04 10:56:02 sebastian Exp $
//
require_once 'PHPUnit/Framework/TestFailure.php';
@@ -66,16 +66,20 @@
private $testFailed = false;
// }}}
- // {{{ public function __construct($file = 'phpunit-log.xml')
+ // {{{ public function __construct($out = null)
/**
- * @param optional string $file
+ * Constructor.
+ *
+ * @param resource $out
* @access public
*/
- public function __construct($file = 'phpunit-log.xml') {
- $this->file = $file;
- $this->tree = new XML_Tree;
- $this->root = $this->tree->addRoot('run');
+ public function __construct($out = null) {
+ if ($out === null) {
+ $out = fopen('php://stdout', 'r');
+ }
+
+ $this->out = $out;
}
// }}}
@@ -85,10 +89,8 @@
* @access public
*/
public function __destruct() {
- if ($fp = @fopen($this->file, 'w')) {
- @fwrite($fp, $this->root->get());
- @fclose($fp);
- }
+ fwrite($fp, $this->root->get());
+ fclose($fp);
}
// }}}