+
+
Forms
+
+
+ {% for formName, formData in collector.data.forms %}
+ {{ form_tree_entry(formName, formData, true) }}
+ {% endfor %}
+
+
+
+ {% for formName, formData in collector.data.forms %}
+ {{ form_tree_details(formName, formData, collector.data.forms_by_hash) }}
+ {% endfor %}
+
+ {% else %}
+
+
+ {{ name }}
+ {% if data.type_class is defined %}
+ [{{ data.type }}]
+ {% endif %}
+
+
+ {% if data.errors is defined and data.errors|length > 0 %}
+
+
+
+
+
+ Message |
+ Origin |
+ Cause |
+
+ {% for error in data.errors %}
+
+ {{ error.message }} |
+
+ {% if error.origin is empty %}
+ This form.
+ {% elseif forms_by_hash[error.origin] is not defined %}
+ Unknown.
+ {% else %}
+ {{ forms_by_hash[error.origin].name }}
+ {% endif %}
+ |
+
+ {% if error.cause is empty %}
+ Unknown.
+ {% elseif error.cause.root is defined %}
+ Constraint Violation
+ {{ error.cause.root }}{% if error.cause.path is not empty %}{% if error.cause.path|first != '[' %}.{% endif %}{{ error.cause.path }}{% endif %} = {{ error.cause.value }}
+ {% else %}
+ {{ error.cause }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if data.default_data is defined %}
+
+
+
+
+
+ Model Format |
+
+ {% if data.default_data.model is defined %}
+ {{ data.default_data.model }}
+ {% else %}
+ same as normalized format
+ {% endif %}
+ |
+
+
+ Normalized Format |
+ {{ data.default_data.norm }} |
+
+
+ View Format |
+
+ {% if data.default_data.view is defined %}
+ {{ data.default_data.view }}
+ {% else %}
+ same as normalized format
+ {% endif %}
+ |
+
+
+
+ {% endif %}
+
+ {% if data.submitted_data is defined %}
+
+
+
+ {% if data.submitted_data.norm is defined %}
+
+
+ View Format |
+
+ {% if data.submitted_data.view is defined %}
+ {{ data.submitted_data.view }}
+ {% else %}
+ same as normalized format
+ {% endif %}
+ |
+
+
+ Normalized Format |
+ {{ data.submitted_data.norm }} |
+
+
+ Model Format |
+
+ {% if data.submitted_data.model is defined %}
+ {{ data.submitted_data.model }}
+ {% else %}
+ same as normalized format
+ {% endif %}
+ |
+
+
+ {% else %}
+
This form was not submitted.
+ {% endif %}
+
+ {% endif %}
+
+ {% if data.passed_options is defined %}
+
+
+
+ {% if data.passed_options|length %}
+
+
+ Option |
+ Passed Value |
+ Resolved Value |
+
+ {% for option, value in data.passed_options %}
+
+ {{ option }} |
+ {{ value }} |
+
+ {% if data.resolved_options[option] is sameas(value) %}
+ same as passed value
+ {% else %}
+ {{ data.resolved_options[option] }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+ {% else %}
+
No options where passed when constructing this form.
+ {% endif %}
+
+ {% endif %}
+
+ {% if data.resolved_options is defined %}
+
+
+
+
+
+ Option |
+ Value |
+
+ {% for option, value in data.resolved_options %}
+
+ {{ option }} |
+ {{ value }} |
+
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if data.view_vars is defined %}
+
+
+
+
+
+ Variable |
+ Value |
+
+ {% for variable, value in data.view_vars %}
+
+ {{ variable }} |
+ {{ value }} |
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
+ {% for childName, childData in data.children %}
+ {{ _self.form_tree_details(childName, childData, forms_by_hash) }}
+ {% endfor %}
+{% endmacro %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
index c4e3df610e913..68fb3e5c74573 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
@@ -22,15 +22,19 @@
},
hasClass = function(el, klass) {
- return el.className.match(new RegExp('\\b' + klass + '\\b'));
+ return el.className && el.className.match(new RegExp('\\b' + klass + '\\b'));
},
removeClass = function(el, klass) {
- el.className = el.className.replace(new RegExp('\\b' + klass + '\\b'), ' ');
+ if (el.className) {
+ el.className = el.className.replace(new RegExp('\\b' + klass + '\\b'), ' ');
+ }
},
addClass = function(el, klass) {
- if (!hasClass(el, klass)) { el.className += " " + klass; }
+ if (!hasClass(el, klass)) {
+ el.className += " " + klass;
+ }
},
getPreference = function(name) {
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
index 7f10150c72bfe..3b45ca11163ec 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
@@ -63,6 +63,9 @@ table th, table td {
font-size: 12px;
padding: 8px 10px;
}
+table td em {
+ color: #aaa;
+}
fieldset {
border: none;
}
@@ -70,6 +73,9 @@ abbr {
border-bottom: 1px dotted #000;
cursor: help;
}
+pre, code {
+ font-size: 0.9em;
+}
.clear {
clear: both;
height: 0;
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
index f9dd1eacd91c8..f114e74671f33 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
@@ -86,7 +86,7 @@ public function testDefaultConfig($debug)
$extension = new WebProfilerExtension();
$extension->load(array(array()), $this->container);
- $this->assertFalse($this->container->get('web_profiler.debug_toolbar')->isEnabled());
+ $this->assertFalse($this->container->has('web_profiler.debug_toolbar'));
$this->assertSaneContainer($this->getDumpedContainer());
}
@@ -94,12 +94,16 @@ public function testDefaultConfig($debug)
/**
* @dataProvider getDebugModes
*/
- public function testToolbarConfig($enabled)
+ public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listenerInjected, $listenerEnabled)
{
$extension = new WebProfilerExtension();
- $extension->load(array(array('toolbar' => $enabled)), $this->container);
+ $extension->load(array(array('toolbar' => $toolbarEnabled, 'intercept_redirects' => $interceptRedirects)), $this->container);
- $this->assertSame($enabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
+ $this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
+
+ if ($listenerInjected) {
+ $this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
+ }
$this->assertSaneContainer($this->getDumpedContainer());
}
@@ -107,8 +111,10 @@ public function testToolbarConfig($enabled)
public function getDebugModes()
{
return array(
- array(true),
- array(false),
+ array(false, false, false, false),
+ array(true, false, true, true),
+ array(false, true, true, false),
+ array(true, true, true, true),
);
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
index beb7b2c387a64..92f0078b2d753 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
@@ -185,6 +185,27 @@ public function testToolbarIsNotInjectedOnNonHtmlRequests()
$this->assertEquals('', $response->getContent());
}
+ public function testXDebugUrlHeader()
+ {
+ $response = new Response();
+ $response->headers->set('X-Debug-Token', 'xxxxxxxx');
+
+ $urlGenerator = $this->getUrlGeneratorMock();
+ $urlGenerator
+ ->expects($this->once())
+ ->method('generate')
+ ->with('_profiler', array('token' => 'xxxxxxxx'))
+ ->will($this->returnValue('/_profiler/xxxxxxxx'))
+ ;
+
+ $event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+
+ $listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, 'bottom', $urlGenerator);
+ $listener->onKernelResponse($event);
+
+ $this->assertEquals('/_profiler/xxxxxxxx', $response->headers->get('X-Debug-Token-Link'));
+ }
+
protected function getRequestMock($isXmlHttpRequest = false, $requestFormat = 'html', $hasSession = true)
{
$request = $this->getMock(
@@ -219,6 +240,11 @@ protected function getTwigMock($render = 'WDT')
return $templating;
}
+ protected function getUrlGeneratorMock()
+ {
+ return $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
+ }
+
protected function getKernelMock()
{
return $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false);
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/TestCase.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/TestCase.php
index 586da133a3843..0c0efeb0e0416 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/TestCase.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/TestCase.php
@@ -13,10 +13,4 @@
class TestCase extends \PHPUnit_Framework_TestCase
{
- protected function setUp()
- {
- if (!class_exists('Twig_Environment')) {
- $this->markTestSkipped('Twig is not available.');
- }
- }
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json
index c3f20e87e7943..2911bd7f7fb07 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/composer.json
+++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json
@@ -33,7 +33,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "2.3-dev"
+ "dev-master": "2.5-dev"
}
}
}
diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php
index cf1445c35b71b..1cdab2e417a4a 100644
--- a/src/Symfony/Component/BrowserKit/Client.php
+++ b/src/Symfony/Component/BrowserKit/Client.php
@@ -32,19 +32,19 @@ abstract class Client
{
protected $history;
protected $cookieJar;
- protected $server;
+ protected $server = array();
protected $internalRequest;
protected $request;
protected $internalResponse;
protected $response;
protected $crawler;
- protected $insulated;
+ protected $insulated = false;
protected $redirect;
- protected $followRedirects;
+ protected $followRedirects = true;
- private $maxRedirects;
- private $redirectCount;
- private $isMainRequest;
+ private $maxRedirects = -1;
+ private $redirectCount = 0;
+ private $isMainRequest = true;
/**
* Constructor.
@@ -58,13 +58,8 @@ abstract class Client
public function __construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
{
$this->setServerParameters($server);
- $this->history = null === $history ? new History() : $history;
- $this->cookieJar = null === $cookieJar ? new CookieJar() : $cookieJar;
- $this->insulated = false;
- $this->followRedirects = true;
- $this->maxRedirects = -1;
- $this->redirectCount = 0;
- $this->isMainRequest = true;
+ $this->history = $history ?: new History();
+ $this->cookieJar = $cookieJar ?: new CookieJar();
}
/**
@@ -102,9 +97,7 @@ public function setMaxRedirects($maxRedirects)
public function insulate($insulated = true)
{
if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) {
- // @codeCoverageIgnoreStart
throw new \RuntimeException('Unable to isolate requests as the Symfony Process Component is not installed.');
- // @codeCoverageIgnoreEnd
}
$this->insulated = (Boolean) $insulated;
@@ -389,9 +382,7 @@ abstract protected function doRequest($request);
*/
protected function getScript($request)
{
- // @codeCoverageIgnoreStart
throw new \LogicException('To insulate requests, you need to override the getScript() method.');
- // @codeCoverageIgnoreEnd
}
/**
diff --git a/src/Symfony/Component/BrowserKit/History.php b/src/Symfony/Component/BrowserKit/History.php
index a22847ef1395f..0c79d5b525125 100644
--- a/src/Symfony/Component/BrowserKit/History.php
+++ b/src/Symfony/Component/BrowserKit/History.php
@@ -21,14 +21,6 @@ class History
protected $stack = array();
protected $position = -1;
- /**
- * Constructor.
- */
- public function __construct()
- {
- $this->clear();
- }
-
/**
* Clears the history.
*/
diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php
index 8eb2549d41f79..45ac52cfca2b4 100644
--- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php
@@ -243,14 +243,6 @@ public function testRequestSecureCookies()
public function testClick()
{
- if (!class_exists('Symfony\Component\DomCrawler\Crawler')) {
- $this->markTestSkipped('The "DomCrawler" component is not available');
- }
-
- if (!class_exists('Symfony\Component\CssSelector\CssSelector')) {
- $this->markTestSkipped('The "CssSelector" component is not available');
- }
-
$client = new TestClient();
$client->setNextResponse(new Response('