Author: fabien
Date: 2010-03-04 13:45:08 +0100 (Thu, 04 Mar 2010)
New Revision: 28376

Added:
   branches/2.0/src/Symfony/Components/OutputEscaper/SafeDecorator.php
   branches/2.0/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php
   
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeDecoratorTest.php
Removed:
   branches/2.0/src/Symfony/Components/OutputEscaper/Safe.php
   branches/2.0/src/Symfony/Framework/ProfilerBundle/RequestDebugData.php
   
branches/2.0/src/Symfony/Framework/WebBundle/Resources/skeleton/bundle/Model/.symfony
   branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeTest.php
Modified:
   branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
   branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php
   branches/2.0/src/Symfony/Components/OutputEscaper/Escaper.php
   branches/2.0/src/Symfony/Foundation/UniversalClassLoader.php
   
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/ConfigDataCollector.php
   
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollectorManager.php
   
branches/2.0/src/Symfony/Framework/ProfilerBundle/Resources/config/collectors.xml
   branches/2.0/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php
   
branches/2.0/tests/fixtures/Symfony/Components/DependencyInjection/php/services9.php
   branches/2.0/tests/unit/Symfony/Components/OutputEscaper/EscaperTest.php
Log:
Merge branch 'master' of git://github.com/symfony/symfony

Modified: branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php
===================================================================
--- branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php 
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Components/DependencyInjection/Builder.php 
2010-03-04 12:45:08 UTC (rev 28376)
@@ -97,14 +97,7 @@
 
       $this->loading[$id] = true;
 
-      if ($definition->isShared())
-      {
-        $service = $this->services[$id] = $this->createService($definition);
-      }
-      else
-      {
-        $service = $this->createService($definition);
-      }
+      $service = $this->createService($definition, $id);
 
       unset($this->loading[$id]);
 
@@ -339,10 +332,11 @@
    * Creates a service for a service definition.
    *
    * @param  Definition $definition A service definition instance
+   * @param  string     $id         The service identifier
    *
    * @return object              The service described by the service 
definition
    */
-  protected function createService(Definition $definition)
+  protected function createService(Definition $definition, $id)
   {
     if (null !== $definition->getFile())
     {
@@ -362,6 +356,11 @@
       $service = null === $r->getConstructor() ? $r->newInstance() : 
$r->newInstanceArgs($arguments);
     }
 
+    if ($definition->isShared())
+    {
+      $this->services[$id] = $service;
+    }
+
     foreach ($definition->getMethodCalls() as $call)
     {
       $services = self::getServiceConditionals($call[1]);

Modified: 
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php
===================================================================
--- 
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php    
    2010-03-04 11:42:10 UTC (rev 28375)
+++ 
branches/2.0/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php    
    2010-03-04 12:45:08 UTC (rev 28376)
@@ -76,24 +76,12 @@
 
   protected function addServiceReturn($id, $definition)
   {
-    if ($definition->isShared())
-    {
-      return <<<EOF
+    return <<<EOF
 
-    return \$this->shared['$id'] = \$instance;
-  }
-
-EOF;
-    }
-    else
-    {
-      return <<<EOF
-
     return \$instance;
   }
 
 EOF;
-    }
   }
 
   protected function addServiceInstance($id, $definition)
@@ -108,19 +96,23 @@
 
     if (null !== $definition->getConstructor())
     {
-      return sprintf("    \$instance = call_user_func(array(%s, '%s')%s);\n", 
$class, $definition->getConstructor(), $arguments ? ', '.implode(', ', 
$arguments) : '');
+      $code = sprintf("    \$instance = call_user_func(array(%s, '%s')%s);\n", 
$class, $definition->getConstructor(), $arguments ? ', '.implode(', ', 
$arguments) : '');
     }
+    elseif ($class != "'".str_replace('\\', '\\\\', 
$definition->getClass())."'")
+    {
+      $code = sprintf("    \$class = %s;\n    \$instance = new 
\$class(%s);\n", $class, implode(', ', $arguments));
+    }
     else
     {
-      if ($class != "'".str_replace('\\', '\\\\', $definition->getClass())."'")
-      {
-        return sprintf("    \$class = %s;\n    \$instance = new 
\$class(%s);\n", $class, implode(', ', $arguments));
-      }
-      else
-      {
-        return sprintf("    \$instance = new %s(%s);\n", 
$definition->getClass(), implode(', ', $arguments));
-      }
+      $code = sprintf("    \$instance = new %s(%s);\n", 
$definition->getClass(), implode(', ', $arguments));
     }
+
+    if ($definition->isShared())
+    {
+      $code .= sprintf("    \$this->shared['$id'] = \$instance;\n");
+    }
+
+    return $code;
   }
 
   protected function addServiceMethodCalls($id, $definition)

Modified: branches/2.0/src/Symfony/Components/OutputEscaper/Escaper.php
===================================================================
--- branches/2.0/src/Symfony/Components/OutputEscaper/Escaper.php       
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Components/OutputEscaper/Escaper.php       
2010-03-04 12:45:08 UTC (rev 28376)
@@ -133,7 +133,7 @@
         // return the unescaped object
         return $value;
       }
-      elseif ($value instanceof Safe)
+      elseif ($value instanceof SafeDecorator)
       {
         // do not escape objects marked as safe
         // return the original object

Deleted: branches/2.0/src/Symfony/Components/OutputEscaper/Safe.php
===================================================================
--- branches/2.0/src/Symfony/Components/OutputEscaper/Safe.php  2010-03-04 
11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Components/OutputEscaper/Safe.php  2010-03-04 
12:45:08 UTC (rev 28376)
@@ -1,79 +0,0 @@
-<?php
-
-namespace Symfony\Components\OutputEscaper;
-
-/*
- * This file is part of the symfony package.
- *
- * (c) Fabien Potencier <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Marks a variable as being safe for output.
- *
- * @package    symfony
- * @subpackage output_escaper
- * @author     Fabien Potencier <[email protected]>
- */
-class Safe extends \ArrayIterator
-{
-  protected $value;
-
-  /**
-   * Constructor.
-   *
-   * @param mixed $value  The value to mark as safe
-   */
-  public function __construct($value)
-  {
-    $this->value = $value;
-
-    if (is_array($value) || is_object($value))
-    {
-      parent::__construct($value);
-    }
-  }
-
-  public function __toString()
-  {
-    return (string) $this->value;
-  }
-
-  public function __get($key)
-  {
-    return $this->value->$key;
-  }
-
-  public function __set($key, $value)
-  {
-    $this->value->$key = $value;
-  }
-
-  public function __call($method, $arguments)
-  {
-    return call_user_func_array(array($this->value, $method), $arguments);
-  }
-
-  public function __isset($key)
-  {
-    return isset($this->value->$key);
-  }
-
-  public function __unset($key)
-  {
-    unset($this->value->$key);
-  }
-
-  /**
-   * Returns the embedded value.
-   *
-   * @return mixed The embedded value
-   */
-  public function getValue()
-  {
-    return $this->value;
-  }
-}

Copied: branches/2.0/src/Symfony/Components/OutputEscaper/SafeDecorator.php 
(from rev 28331, branches/2.0/src/Symfony/Components/OutputEscaper/Safe.php)
===================================================================
--- branches/2.0/src/Symfony/Components/OutputEscaper/SafeDecorator.php         
                (rev 0)
+++ branches/2.0/src/Symfony/Components/OutputEscaper/SafeDecorator.php 
2010-03-04 12:45:08 UTC (rev 28376)
@@ -0,0 +1,79 @@
+<?php
+
+namespace Symfony\Components\OutputEscaper;
+
+/*
+ * This file is part of the symfony package.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Marks a variable as being safe for output.
+ *
+ * @package    symfony
+ * @subpackage output_escaper
+ * @author     Fabien Potencier <[email protected]>
+ */
+class SafeDecorator extends \ArrayIterator
+{
+  protected $value;
+
+  /**
+   * Constructor.
+   *
+   * @param mixed $value  The value to mark as safe
+   */
+  public function __construct($value)
+  {
+    $this->value = $value;
+
+    if (is_array($value) || is_object($value))
+    {
+      parent::__construct($value);
+    }
+  }
+
+  public function __toString()
+  {
+    return (string) $this->value;
+  }
+
+  public function __get($key)
+  {
+    return $this->value->$key;
+  }
+
+  public function __set($key, $value)
+  {
+    $this->value->$key = $value;
+  }
+
+  public function __call($method, $arguments)
+  {
+    return call_user_func_array(array($this->value, $method), $arguments);
+  }
+
+  public function __isset($key)
+  {
+    return isset($this->value->$key);
+  }
+
+  public function __unset($key)
+  {
+    unset($this->value->$key);
+  }
+
+  /**
+   * Returns the embedded value.
+   *
+   * @return mixed The embedded value
+   */
+  public function getValue()
+  {
+    return $this->value;
+  }
+}

Modified: branches/2.0/src/Symfony/Foundation/UniversalClassLoader.php
===================================================================
--- branches/2.0/src/Symfony/Foundation/UniversalClassLoader.php        
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Foundation/UniversalClassLoader.php        
2010-03-04 12:45:08 UTC (rev 28376)
@@ -58,6 +58,16 @@
   protected $namespaces = array();
   protected $prefixes = array();
 
+  public function getNamespaces()
+  {
+    return $this->namespaces;
+  }
+
+  public function getPrefixes()
+  {
+    return $this->prefixes;
+  }
+
   /**
    * Registers an array of namespaces
    *

Modified: 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/ConfigDataCollector.php
===================================================================
--- 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/ConfigDataCollector.php
     2010-03-04 11:42:10 UTC (rev 28375)
+++ 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/ConfigDataCollector.php
     2010-03-04 12:45:08 UTC (rev 28376)
@@ -26,7 +26,7 @@
     $kernel = $this->container->getKernelService();
 
     return array(
-      'token'           => $this->manager->getRequestDebugData()->getToken(),
+      'token'           => $this->manager->getProfilerStorage()->getToken(),
       'symfony_version' => Kernel::VERSION,
       'name'            => $kernel->getName(),
       'env'             => $kernel->getEnvironment(),

Modified: 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollectorManager.php
===================================================================
--- 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollectorManager.php
    2010-03-04 11:42:10 UTC (rev 28375)
+++ 
branches/2.0/src/Symfony/Framework/ProfilerBundle/DataCollector/DataCollectorManager.php
    2010-03-04 12:45:08 UTC (rev 28376)
@@ -5,7 +5,7 @@
 use Symfony\Components\DependencyInjection\ContainerInterface;
 use Symfony\Components\EventDispatcher\Event;
 use Symfony\Components\RequestHandler\Response;
-use Symfony\Framework\ProfilerBundle\RequestDebugData;
+use Symfony\Framework\ProfilerBundle\ProfilerStorage;
 
 /*
  * This file is part of the symfony framework.
@@ -25,16 +25,16 @@
 class DataCollectorManager
 {
   protected $container;
-  protected $requestDebugData;
+  protected $profilerStorage;
   protected $collectors;
   protected $response;
   protected $lifetime;
 
-  public function __construct(ContainerInterface $container, $lifetime = 86400)
+  public function __construct(ContainerInterface $container, ProfilerStorage 
$profilerStorage, $lifetime = 86400)
   {
     $this->container = $container;
     $this->lifetime = $lifetime;
-    $this->requestDebugData = new RequestDebugData(uniqid(), 
$this->container->getParameter('kernel.cache_dir').'/debug.db');
+    $this->profilerStorage = $profilerStorage;
     $this->collectors = $this->initCollectors();
   }
 
@@ -57,15 +57,15 @@
     {
       $data[$name] = $collector->getData();
     }
-    $this->requestDebugData->write($data);
-    $this->requestDebugData->purge($this->lifetime);
+    $this->profilerStorage->write($data);
+    $this->profilerStorage->purge($this->lifetime);
 
     return $response;
   }
 
-  public function getRequestDebugData()
+  public function getProfilerStorage()
   {
-    return $this->requestDebugData;
+    return $this->profilerStorage;
   }
 
   public function getResponse()

Copied: branches/2.0/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php 
(from rev 28331, 
branches/2.0/src/Symfony/Framework/ProfilerBundle/RequestDebugData.php)
===================================================================
--- branches/2.0/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php       
                        (rev 0)
+++ branches/2.0/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php       
2010-03-04 12:45:08 UTC (rev 28376)
@@ -0,0 +1,92 @@
+<?php
+
+namespace Symfony\Framework\ProfilerBundle;
+
+/*
+ * This file is part of the symfony framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * 
+ *
+ * @package    symfony
+ * @author     Fabien Potencier <[email protected]>
+ */
+class ProfilerStorage
+{
+  protected $token;
+  protected $data;
+  protected $store;
+
+  public function __construct($store, $token = null)
+  {
+    $this->store = $store;
+    $this->token = null === $token ? uniqid() : $token;
+    $this->data = null;
+  }
+
+  public function hasData()
+  {
+    return null !== $this->data;
+  }
+
+  public function getData($name = null)
+  {
+    if (null === $this->data)
+    {
+      $this->data = $this->read();
+    }
+
+    if (null === $name)
+    {
+      return $this->data;
+    }
+
+    return isset($this->data[$name]) ? $this->data[$name] : null;
+  }
+
+  public function getToken()
+  {
+    return $this->token;
+  }
+
+  protected function read()
+  {
+    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READ);
+    $data = $db->querySingle(sprintf("SELECT data FROM data WHERE token = '%s' 
LIMIT 1 ORDER BY created_at DESC", $db->escapeString($this->token)));
+
+    $this->data = unserialize(pack('H*', $data));
+
+    $db->close();
+  }
+
+  public function write($data)
+  {
+    $unpack = unpack('H*', serialize($data));
+    $data = $unpack[1];
+
+    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
+    $db->exec(sprintf("INSERT INTO data (token, data, created_at) VALUES 
('%s', '%s', %s)", $db->escapeString($this->token), $db->escapeString($data), 
time()));
+    $db->close();
+  }
+
+  protected function initDb($flags)
+  {
+    $db = new \SQLite3($this->store, $flags);
+    $db->exec('CREATE TABLE IF NOT EXISTS data (token STRING, data STRING, 
created_at TIMESTAMP)');
+    $db->exec('CREATE INDEX IF NOT EXISTS data_data ON data (created_at)');
+
+    return $db;
+  }
+
+  public function purge($lifetime)
+  {
+    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
+    $db->exec(sprintf("DELETE FROM data WHERE strftime('%%s', 'now') - 
created_at > %d", $lifetime));
+  }
+}

Deleted: branches/2.0/src/Symfony/Framework/ProfilerBundle/RequestDebugData.php
===================================================================
--- branches/2.0/src/Symfony/Framework/ProfilerBundle/RequestDebugData.php      
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Framework/ProfilerBundle/RequestDebugData.php      
2010-03-04 12:45:08 UTC (rev 28376)
@@ -1,86 +0,0 @@
-<?php
-
-namespace Symfony\Framework\ProfilerBundle;
-
-/*
- * This file is part of the symfony framework.
- *
- * (c) Fabien Potencier <[email protected]>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-/**
- * 
- *
- * @package    symfony
- * @author     Fabien Potencier <[email protected]>
- */
-class RequestDebugData
-{
-  protected $token;
-  protected $data;
-  protected $store;
-
-  public function __construct($token, $store)
-  {
-    $this->token = $token;
-    $this->store = $store;
-    $this->data = null;
-  }
-
-  public function hasData()
-  {
-    return null !== $this->data;
-  }
-
-  public function getData($name = null)
-  {
-    if (null === $this->data)
-    {
-      $this->data = $this->read();
-    }
-
-    if (null === $name)
-    {
-      return $this->data;
-    }
-
-    return isset($this->data[$name]) ? $this->data[$name] : null;
-  }
-
-  public function getToken()
-  {
-    return $this->token;
-  }
-
-  protected function read()
-  {
-    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READ);
-    $this->data = $db->querySingle(sprintf("SELECT data FROM data WHERE token 
= '%s' LIMIT 1 ORDER BY created_at DESC", $db->escapeString($this->token)));
-    $db->close();
-  }
-
-  public function write($data)
-  {
-    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
-    $db->exec(sprintf("INSERT INTO data (token, data, created_at) VALUES 
('%s', '%s', %s)", $db->escapeString($this->token), 
$db->escapeString(serialize($data)), time()));
-    $db->close();
-  }
-
-  protected function initDb($flags)
-  {
-    $db = new \SQLite3($this->store, $flags);
-    $db->exec('CREATE TABLE IF NOT EXISTS data (token STRING, data STRING, 
created_at TIMESTAMP)');
-    $db->exec('CREATE INDEX IF NOT EXISTS data_data ON data (created_at)');
-
-    return $db;
-  }
-
-  public function purge($lifetime)
-  {
-    $db = $this->initDb(SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
-    $db->exec(sprintf("DELETE FROM data WHERE strftime('%%s', 'now') - 
created_at > %d", $lifetime));
-  }
-}

Modified: 
branches/2.0/src/Symfony/Framework/ProfilerBundle/Resources/config/collectors.xml
===================================================================
--- 
branches/2.0/src/Symfony/Framework/ProfilerBundle/Resources/config/collectors.xml
   2010-03-04 11:42:10 UTC (rev 28375)
+++ 
branches/2.0/src/Symfony/Framework/ProfilerBundle/Resources/config/collectors.xml
   2010-03-04 12:45:08 UTC (rev 28376)
@@ -6,6 +6,8 @@
 
   <parameters>
     <parameter 
key="data_collector_manager.class">Symfony\Framework\ProfilerBundle\DataCollector\DataCollectorManager</parameter>
+    <parameter 
key="data_collector_manager.storage.class">Symfony\Framework\ProfilerBundle\ProfilerStorage</parameter>
+    <parameter 
key="data_collector_manager.storage.file">%kernel.cache_dir%/profiler.db</parameter>
     <parameter key="data_collector_manager.lifetime">86400</parameter>
     <parameter 
key="data_collector.config.class">Symfony\Framework\ProfilerBundle\DataCollector\ConfigDataCollector</parameter>
     <parameter 
key="data_collector.app.class">Symfony\Framework\ProfilerBundle\DataCollector\AppDataCollector</parameter>
@@ -17,9 +19,14 @@
     <service id="data_collector_manager" 
class="%data_collector_manager.class%">
       <annotation name="kernel.listener" event="core.response" method="handle" 
/>
       <argument type="service" id="service_container" />
+      <argument type="service" id="data_collector_manager.storage" />
       <argument>%data_collector_manager.lifetime%</argument>
     </service>
 
+    <service id="data_collector_manager.storage" 
class="%data_collector_manager.storage.class%">
+      <argument>%data_collector_manager.storage.file%</argument>
+    </service>
+
     <service id="data_collector.config" class="%data_collector.config.class%">
       <annotation name="data_collector" core="true" />
       <argument type="service" id="service_container" />

Modified: 
branches/2.0/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php
===================================================================
--- branches/2.0/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php  
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php  
2010-03-04 12:45:08 UTC (rev 28376)
@@ -85,7 +85,7 @@
       {
         if (null !== $this->logger)
         {
-          $logs[] = sprintf('Failed finding controller "%s:%s" from namespace 
"%s"', $bundle, $controller, $namespace);
+          $logs[] = sprintf('Failed finding controller "%s:%s" from namespace 
"%s" (%s)', $bundle, $controller, $namespace, $try);
         }
       }
       else

Modified: 
branches/2.0/tests/fixtures/Symfony/Components/DependencyInjection/php/services9.php
===================================================================
--- 
branches/2.0/tests/fixtures/Symfony/Components/DependencyInjection/php/services9.php
        2010-03-04 11:42:10 UTC (rev 28375)
+++ 
branches/2.0/tests/fixtures/Symfony/Components/DependencyInjection/php/services9.php
        2010-03-04 12:45:08 UTC (rev 28376)
@@ -61,9 +61,10 @@
     if (isset($this->shared['bar'])) return $this->shared['bar'];
 
     $instance = new FooClass('foo', $this->getFoo_BazService(), 
$this->getParameter('foo_bar'));
+    $this->shared['bar'] = $instance;
     $this->getFoo_BazService()->configure($instance);
 
-    return $this->shared['bar'] = $instance;
+    return $instance;
   }
 
   /**
@@ -79,9 +80,10 @@
     if (isset($this->shared['foo.baz'])) return $this->shared['foo.baz'];
 
     $instance = call_user_func(array($this->getParameter('baz_class'), 
'getInstance'));
+    $this->shared['foo.baz'] = $instance;
     call_user_func(array($this->getParameter('baz_class'), 
'configureStatic1'), $instance);
 
-    return $this->shared['foo.baz'] = $instance;
+    return $instance;
   }
 
   /**
@@ -98,8 +100,9 @@
 
     $class = $this->getParameter('foo_class');
     $instance = new $class();
+    $this->shared['foo_bar'] = $instance;
 
-    return $this->shared['foo_bar'] = $instance;
+    return $instance;
   }
 
   /**
@@ -115,6 +118,7 @@
     if (isset($this->shared['method_call1'])) return 
$this->shared['method_call1'];
 
     $instance = new FooClass();
+    $this->shared['method_call1'] = $instance;
     $instance->setBar($this->getFooService());
     $instance->setBar($this->getService('foo', 
Container::NULL_ON_INVALID_REFERENCE));
     if ($this->hasService('foo'))
@@ -126,7 +130,7 @@
       $instance->setBar($this->getService('foobaz', 
Container::NULL_ON_INVALID_REFERENCE));
     }
 
-    return $this->shared['method_call1'] = $instance;
+    return $instance;
   }
 
   /**

Modified: 
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/EscaperTest.php
===================================================================
--- branches/2.0/tests/unit/Symfony/Components/OutputEscaper/EscaperTest.php    
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/tests/unit/Symfony/Components/OutputEscaper/EscaperTest.php    
2010-03-04 12:45:08 UTC (rev 28376)
@@ -12,7 +12,7 @@
 require_once __DIR__.'/../../../bootstrap.php';
 
 use Symfony\Components\OutputEscaper\Escaper;
-use Symfony\Components\OutputEscaper\Safe;
+use Symfony\Components\OutputEscaper\SafeDecorator;
 use Symfony\Components\OutputEscaper\IteratorDecorator;
 use Symfony\Components\OutputEscaper\ArrayDecorator;
 use Symfony\Components\OutputEscaper\ObjectDecorator;
@@ -78,7 +78,7 @@
 $t->ok(Escaper::escape('entities', new \DirectoryIterator('.')) instanceof 
IteratorDecorator, '::escape() returns a IteratorDecorator object if the value 
to escape is an object that implements the ArrayAccess interface');
 
 $t->diag('::escape() does not escape object marked as being safe');
-$t->ok(Escaper::escape('entities', new Safe(new OutputEscaperTestClass())) 
instanceof OutputEscaperTestClass, '::escape() returns the original value if it 
is marked as being safe');
+$t->ok(Escaper::escape('entities', new SafeDecorator(new 
OutputEscaperTestClass())) instanceof OutputEscaperTestClass, '::escape() 
returns the original value if it is marked as being safe');
 
 Escaper::markClassAsSafe('OutputEscaperTestClass');
 $t->ok(Escaper::escape('entities', new OutputEscaperTestClass()) instanceof 
OutputEscaperTestClass, '::escape() returns the original value if the object 
class is marked as being safe');
@@ -129,7 +129,7 @@
 $t->ok(IteratorDecorator::unescape(Escaper::escape('entities', new 
DirectoryIterator('.'))) instanceof DirectoryIterator, '::unescape() unescapes 
IteratorDecorator objects');
 
 $t->diag('::unescape() does not unescape object marked as being safe');
-$t->ok(Escaper::unescape(Escaper::escape('entities', new Safe(new 
OutputEscaperTestClass()))) instanceof OutputEscaperTestClass, '::unescape() 
returns the original value if it is marked as being safe');
+$t->ok(Escaper::unescape(Escaper::escape('entities', new SafeDecorator(new 
OutputEscaperTestClass()))) instanceof OutputEscaperTestClass, '::unescape() 
returns the original value if it is marked as being safe');
 
 Escaper::markClassAsSafe('OutputEscaperTestClass');
 $t->ok(Escaper::unescape(Escaper::escape('entities', new 
OutputEscaperTestClass())) instanceof OutputEscaperTestClass, '::unescape() 
returns the original value if the object class is marked as being safe');

Copied: 
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeDecoratorTest.php 
(from rev 28331, 
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeTest.php)
===================================================================
--- 
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeDecoratorTest.php  
                            (rev 0)
+++ 
branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeDecoratorTest.php  
    2010-03-04 12:45:08 UTC (rev 28376)
@@ -0,0 +1,93 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require_once __DIR__.'/../../../bootstrap.php';
+
+use Symfony\Components\OutputEscaper\SafeDecorator;
+
+$t = new LimeTest(13);
+
+// ->getValue()
+$t->diag('->getValue()');
+$safe = new SafeDecorator('foo');
+$t->is($safe->getValue(), 'foo', '->getValue() returns the embedded value');
+
+// ->__set() ->__get()
+$t->diag('->__set() ->__get()');
+
+class TestClass1
+{
+  public $foo = 'bar';
+}
+
+$safe = new SafeDecorator(new TestClass1());
+
+$t->is($safe->foo, 'bar', '->__get() returns the object parameter');
+$safe->foo = 'baz';
+$t->is($safe->foo, 'baz', '->__set() sets the object parameter');
+
+// ->__call()
+$t->diag('->__call()');
+
+class TestClass2
+{
+  public function doSomething()
+  {
+    return 'ok';
+  }
+}
+
+$safe = new SafeDecorator(new TestClass2());
+$t->is($safe->doSomething(), 'ok', '->__call() invokes the embedded method');
+
+// ->__isset() ->__unset()
+$t->diag('->__isset() ->__unset()');
+
+class TestClass3
+{
+  public
+    $boolValue = true,
+    $nullValue = null;
+}
+
+$safe = new SafeDecorator(new TestClass3());
+
+$t->is(isset($safe->boolValue), true, '->__isset() returns true if the 
property is not null');
+$t->is(isset($safe->nullValue), false, '->__isset() returns false if the 
property is null');
+$t->is(isset($safe->undefinedValue), false, '->__isset() returns false if the 
property does not exist');
+
+unset($safe->boolValue);
+$t->is(isset($safe->boolValue), false, '->__unset() unsets the embedded 
property');
+
+// Iterator
+$t->diag('Iterator');
+
+$input = array('one' => 1, 'two' => 2, 'three' => 3, 'children' => array(1, 2, 
3));
+$output = array();
+
+$safe = new SafeDecorator($input);
+foreach ($safe as $key => $value)
+{
+  $output[$key] = $value;
+}
+$t->same($output, $input, '"Iterator" implementation imitates an array');
+
+// ArrayAccess
+$t->diag('ArrayAccess');
+
+$safe = new SafeDecorator(array('foo' => 'bar'));
+
+$t->is($safe['foo'], 'bar', '"ArrayAccess" implementation returns a value from 
the embedded array');
+$safe['foo'] = 'baz';
+$t->is($safe['foo'], 'baz', '"ArrayAccess" implementation sets a value on the 
embedded array');
+$t->is(isset($safe['foo']), true, '"ArrayAccess" checks if a value is set on 
the embedded array');
+unset($safe['foo']);
+$t->is(isset($safe['foo']), false, '"ArrayAccess" unsets a value on the 
embedded array');

Deleted: branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeTest.php
===================================================================
--- branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeTest.php       
2010-03-04 11:42:10 UTC (rev 28375)
+++ branches/2.0/tests/unit/Symfony/Components/OutputEscaper/SafeTest.php       
2010-03-04 12:45:08 UTC (rev 28376)
@@ -1,93 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- *
- * (c) Fabien Potencier <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-require_once __DIR__.'/../../../bootstrap.php';
-
-use Symfony\Components\OutputEscaper\Safe;
-
-$t = new LimeTest(13);
-
-// ->getValue()
-$t->diag('->getValue()');
-$safe = new Safe('foo');
-$t->is($safe->getValue(), 'foo', '->getValue() returns the embedded value');
-
-// ->__set() ->__get()
-$t->diag('->__set() ->__get()');
-
-class TestClass1
-{
-  public $foo = 'bar';
-}
-
-$safe = new Safe(new TestClass1());
-
-$t->is($safe->foo, 'bar', '->__get() returns the object parameter');
-$safe->foo = 'baz';
-$t->is($safe->foo, 'baz', '->__set() sets the object parameter');
-
-// ->__call()
-$t->diag('->__call()');
-
-class TestClass2
-{
-  public function doSomething()
-  {
-    return 'ok';
-  }
-}
-
-$safe = new Safe(new TestClass2());
-$t->is($safe->doSomething(), 'ok', '->__call() invokes the embedded method');
-
-// ->__isset() ->__unset()
-$t->diag('->__isset() ->__unset()');
-
-class TestClass3
-{
-  public
-    $boolValue = true,
-    $nullValue = null;
-}
-
-$safe = new Safe(new TestClass3());
-
-$t->is(isset($safe->boolValue), true, '->__isset() returns true if the 
property is not null');
-$t->is(isset($safe->nullValue), false, '->__isset() returns false if the 
property is null');
-$t->is(isset($safe->undefinedValue), false, '->__isset() returns false if the 
property does not exist');
-
-unset($safe->boolValue);
-$t->is(isset($safe->boolValue), false, '->__unset() unsets the embedded 
property');
-
-// Iterator
-$t->diag('Iterator');
-
-$input = array('one' => 1, 'two' => 2, 'three' => 3, 'children' => array(1, 2, 
3));
-$output = array();
-
-$safe = new Safe($input);
-foreach ($safe as $key => $value)
-{
-  $output[$key] = $value;
-}
-$t->same($output, $input, '"Iterator" implementation imitates an array');
-
-// ArrayAccess
-$t->diag('ArrayAccess');
-
-$safe = new Safe(array('foo' => 'bar'));
-
-$t->is($safe['foo'], 'bar', '"ArrayAccess" implementation returns a value from 
the embedded array');
-$safe['foo'] = 'baz';
-$t->is($safe['foo'], 'baz', '"ArrayAccess" implementation sets a value on the 
embedded array');
-$t->is(isset($safe['foo']), true, '"ArrayAccess" checks if a value is set on 
the embedded array');
-unset($safe['foo']);
-$t->is(isset($safe['foo']), false, '"ArrayAccess" unsets a value on the 
embedded array');

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to