Author: Derick Rethans
Date: 2007-01-19 12:55:49 +0100 (Fri, 19 Jan 2007)
New Revision: 4530

Log:
- Implemented issue #9965: Support for delayed initialization through
  ezcBaseInit.

Added:
   trunk/Debug/tests/debug_delayed_init_test.php
   trunk/Debug/tests/test_classes.php
Modified:
   trunk/Debug/ChangeLog
   trunk/Debug/src/debug.php
   trunk/Debug/tests/suite.php

Modified: trunk/Debug/ChangeLog
===================================================================
--- trunk/Debug/ChangeLog       2007-01-19 11:54:22 UTC (rev 4529)
+++ trunk/Debug/ChangeLog       2007-01-19 11:55:49 UTC (rev 4530)
@@ -1,3 +1,10 @@
+1.1beta1 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Implemented issue #9965: Support for delayed initialization through
+  ezcBaseInit.
+
+
 1.0.3 - Monday 20 November 2006
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

Modified: trunk/Debug/src/debug.php
===================================================================
--- trunk/Debug/src/debug.php   2007-01-19 11:54:22 UTC (rev 4529)
+++ trunk/Debug/src/debug.php   2007-01-19 11:55:49 UTC (rev 4530)
@@ -178,12 +178,13 @@
      */
     public static function getInstance()
     {
-        if ( is_null( ezcDebug::$instance ))
+        if ( is_null( self::$instance ))
         {
-            ezcDebug::$instance = new ezcDebug();
+            self::$instance = new ezcDebug();
+            ezcBaseInit::fetchConfig( 'ezcInitDebug', self::$instance );
         }
 
-        return ezcDebug::$instance;
+        return self::$instance;
     }
 
     /** 

Added: trunk/Debug/tests/debug_delayed_init_test.php
===================================================================
--- trunk/Debug/tests/debug_delayed_init_test.php       2007-01-19 11:54:22 UTC 
(rev 4529)
+++ trunk/Debug/tests/debug_delayed_init_test.php       2007-01-19 11:55:49 UTC 
(rev 4530)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ * @version //autogentag//
+ * @filesource
+ * @package Debug
+ * @subpackage Tests
+ */
+
+require_once( "test_classes.php" );
+
+/**
+ * @package Debug
+ * @subpackage Tests
+ */
+class ezcDebugDelayedInitTest extends ezcTestCase
+{
+    private $dbg;
+
+    public function testDelayedInit()
+    {
+        ezcBaseInit::setCallback( 'ezcInitDebug', 'testDelayedInitDebug' );
+        $dbg = ezcDebug::getInstance();
+        $this->assertAttributeEquals( new TestReporter(), 'formatter', $dbg );
+    }
+
+    public static function suite()
+    {
+        return new PHPUnit_Framework_TestSuite("ezcDebugDelayedInitTest");
+    }
+}
+
+?>


Property changes on: trunk/Debug/tests/debug_delayed_init_test.php
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/Debug/tests/suite.php
===================================================================
--- trunk/Debug/tests/suite.php 2007-01-19 11:54:22 UTC (rev 4529)
+++ trunk/Debug/tests/suite.php 2007-01-19 11:55:49 UTC (rev 4530)
@@ -1,4 +1,5 @@
 <?php
+require_once( "debug_delayed_init_test.php");
 require_once( "debug_test.php");
 require_once( "debug_timer_test.php");
 require_once( "writers/memory_writer_test.php");
@@ -11,6 +12,7 @@
                parent::__construct();
         $this->setName("Debug");
         
+               $this->addTest( ezcDebugDelayedInitTest::suite() );
                $this->addTest( ezcDebugMemoryWriterTest::suite() );
                $this->addTest( ezcDebugTimerTest::suite() );
                $this->addTest( ezcDebugTest::suite() );

Added: trunk/Debug/tests/test_classes.php
===================================================================
--- trunk/Debug/tests/test_classes.php  2007-01-19 11:54:22 UTC (rev 4529)
+++ trunk/Debug/tests/test_classes.php  2007-01-19 11:55:49 UTC (rev 4530)
@@ -0,0 +1,9 @@
+<?php
+class testDelayedInitDebug
+{
+    static function configureObject( $object )
+    {
+        $object->setOutputFormatter( new TestReporter() );
+    }
+}
+?>


Property changes on: trunk/Debug/tests/test_classes.php
___________________________________________________________________
Name: svn:eol-style
   + native

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

Reply via email to