Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner #12145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Symfony\Bridge\Twig\Extension\DumpExtension;
use Symfony\Component\VarDumper\VarDumper;
use Symfony\Component\VarDumper\Cloner\PhpCloner;
use Symfony\Component\VarDumper\Cloner\VarCloner;

class DumpExtensionTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -22,7 +22,7 @@ class DumpExtensionTest extends \PHPUnit_Framework_TestCase
*/
public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped)
{
$extension = new DumpExtension(new PhpCloner());
$extension = new DumpExtension(new VarCloner());
$twig = new \Twig_Environment(new \Twig_Loader_String(), array(
'debug' => $debug,
'cache' => false,
Expand Down Expand Up @@ -62,7 +62,7 @@ public function getDumpTags()
*/
public function testDump($context, $args, $expectedOutput, $debug = true)
{
$extension = new DumpExtension(new PhpCloner());
$extension = new DumpExtension(new VarCloner());
$twig = new \Twig_Environment(new \Twig_Loader_String(), array(
'debug' => $debug,
'cache' => false,
Expand All @@ -77,7 +77,7 @@ public function testDump($context, $args, $expectedOutput, $debug = true)
if ($debug) {
$this->assertStringStartsWith('<script>', $dump);
$dump = preg_replace('/^.*?<pre/', '<pre', $dump);
$dump = preg_replace('/sf-dump-\\d{2,}/', 'sf-dump', $dump);
$dump = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump);
}
$this->assertEquals($expectedOutput, $dump);
}
Expand All @@ -86,20 +86,20 @@ public function getDumpArgs()
{
return array(
array(array(), array(), '', false),
array(array(), array(), "<pre class=sf-dump>[]\n</pre><script>Sfjs.dump.instrument()</script>\n"),
array(array(), array(), "<pre class=sf-dump>[]\n</pre><script>Sfdump.instrument()</script>\n"),
array(
array(),
array(123, 456),
"<pre class=sf-dump><span class=sf-dump-num>123</span>\n</pre><script>Sfjs.dump.instrument()</script>\n"
."<pre class=sf-dump><span class=sf-dump-num>456</span>\n</pre><script>Sfjs.dump.instrument()</script>\n",
"<pre class=sf-dump><span class=sf-dump-num>123</span>\n</pre><script>Sfdump.instrument()</script>\n"
."<pre class=sf-dump><span class=sf-dump-num>456</span>\n</pre><script>Sfdump.instrument()</script>\n",
),
array(
array('foo' => 'bar'),
array(),
"<pre class=sf-dump><span class=sf-dump-note>array:1</span> [<span name=sf-dump-child>\n"
." \"<span class=sf-dump-meta>foo</span>\" => \"<span class=sf-dump-str>bar</span>\"\n"
."</span>]\n"
."</pre><script>Sfjs.dump.instrument()</script>\n",
."</pre><script>Sfdump.instrument()</script>\n",
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public function load(array $configs, ContainerBuilder $container)
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');

$container->setParameter(
'var_dumper.cloner.class',
'Symfony\Component\VarDumper\Cloner\\'.(function_exists('symfony_zval_info') ? 'Ext' : 'Php').'Cloner'
);

$container->getDefinition('var_dumper.cloner')
->addMethodCall('setMaxItems', array($config['max_items']))
->addMethodCall('setMaxString', array($config['max_string_length']));
Expand Down
11 changes: 3 additions & 8 deletions src/Symfony/Bundle/DebugBundle/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="data_collector.dump.class">Symfony\Component\HttpKernel\DataCollector\DumpDataCollector</parameter>
<parameter key="debug.dump_listener.class">Symfony\Component\HttpKernel\EventListener\DumpListener</parameter>
</parameters>

<services>
<service id="data_collector.dump" class="%data_collector.dump.class%">
<service id="data_collector.dump" class="Symfony\Component\HttpKernel\DataCollector\DumpDataCollector">
<tag name="data_collector" id="dump" template="@Debug/Profiler/dump.html.twig" />
<argument type="service" id="debug.stopwatch" on-invalid="ignore" />
<argument>%templating.helper.code.file_link_format%</argument>
</service>

<service id="debug.dump_listener" class="%debug.dump_listener.class%">
<service id="debug.dump_listener" class="Symfony\Component\HttpKernel\EventListener\DumpListener">
<tag name="kernel.event_subscriber" />
<argument type="service" id="service_container" />
<argument>data_collector.dump</argument>
</service>

<service id="var_dumper.cloner" class="%var_dumper.cloner.class%" />
<service id="var_dumper.cloner" class="Symfony\Component\VarDumper\Cloner\VarCloner" />
</services>

</container>
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
{{ dump.name }}
{% endif %}
line {{ dump.line }}:
<a onclick="Sfjs.dump.toggle(this)">▶</a>
<a onclick="Sfdump.toggle(this)">▶</a>
<span class="sf-dump-compact">
{% if dump.fileExcerpt %}{{ dump.fileExcerpt|raw }}{% else %}{{ dump.file|file_excerpt(dump.line) }}{% endif %}
</span>
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bundle/TwigBundle/Resources/config/debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<parameters>
<parameter key="debug.templating.engine.twig.class">Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine</parameter>
<parameter key="twig.extension.dump.class">Symfony\Bridge\Twig\Extension\DumpExtension</parameter>
</parameters>

<services>
Expand All @@ -17,7 +16,7 @@
<argument type="service" id="debug.stopwatch" />
</service>

<service id="twig.extension.dump" class="%twig.extension.dump.class%" public="false">
<service id="twig.extension.dump" class="Symfony\Bridge\Twig\Extension\DumpExtension" public="false">
<tag name="twig.extension" />
<argument type="service" id="var_dumper.cloner" on-invalid="null" />
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testDump()

$xDump = array(
array(
'data' => "<pre class=sf-dump><span class=sf-dump-num>123</span>\n</pre><script>Sfjs.dump.instrument()</script>\n",
'data' => "<pre class=sf-dump><span class=sf-dump-num>123</span>\n</pre><script>Sfdump.instrument()</script>\n",
'name' => 'DumpDataCollectorTest.php',
'file' => __FILE__,
'line' => $line,
Expand Down
201 changes: 0 additions & 201 deletions src/Symfony/Component/VarDumper/Cloner/ExtCloner.php

This file was deleted.

Loading