Permalink
Browse files

moved the Stopwatch classes to their own component

  • Loading branch information...
1 parent c290776 commit 6b54a519632bd11ff44f34c67a0160379738f3e7 @fabpot fabpot committed Nov 9, 2012
Showing with 126 additions and 19 deletions.
  1. +1 −1 src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
  2. +3 −0 src/Symfony/Bridge/Doctrine/composer.json
  3. +2 −2 src/Symfony/Bridge/Propel1/Logger/PropelLogger.php
  4. +3 −0 src/Symfony/Bridge/Propel1/composer.json
  5. +1 −1 src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml
  6. +1 −0 src/Symfony/Bundle/FrameworkBundle/composer.json
  7. +1 −1 src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php
  8. +3 −0 src/Symfony/Bundle/TwigBundle/composer.json
  9. +1 −0 src/Symfony/Component/HttpKernel/CHANGELOG.md
  10. +1 −1 src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php
  11. +1 −1 src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
  12. +1 −1 src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
  13. +2 −1 src/Symfony/Component/HttpKernel/composer.json
  14. +2 −0 src/Symfony/Component/Stopwatch/.gitattributes
  15. +1 −0 src/Symfony/Component/Stopwatch/.gitignore
  16. +19 −0 src/Symfony/Component/Stopwatch/LICENSE
  17. +13 −0 src/Symfony/Component/Stopwatch/README.md
  18. +1 −1 src/Symfony/Component/{HttpKernel/Debug → Stopwatch}/Stopwatch.php
  19. +1 −1 src/Symfony/Component/{HttpKernel/Debug → Stopwatch}/StopwatchEvent.php
  20. +1 −1 src/Symfony/Component/{HttpKernel/Debug → Stopwatch}/StopwatchPeriod.php
  21. +2 −2 src/Symfony/Component/{HttpKernel/Tests/Debug → Stopwatch/Tests}/StopwatchEventTest.php
  22. +5 −5 src/Symfony/Component/{HttpKernel/Tests/Debug → Stopwatch/Tests}/StopwatchTest.php
  23. +31 −0 src/Symfony/Component/Stopwatch/composer.json
  24. +29 −0 src/Symfony/Component/Stopwatch/phpunit.xml.dist
@@ -12,7 +12,7 @@
namespace Symfony\Bridge\Doctrine\Logger;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
use Doctrine\DBAL\Logging\SQLLogger;
/**
@@ -19,6 +19,9 @@
"php": ">=5.3.3",
"doctrine/common": ">=2.2,<2.4-dev"
},
+ "require-dev": {
+ "symfony/stopwatch": "2.2.*"
+ },
"suggest": {
"symfony/form": "2.2.*",
"symfony/validator": "2.2.*",
@@ -11,7 +11,7 @@
namespace Symfony\Bridge\Propel1\Logger;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
/**
@@ -33,7 +33,7 @@ class PropelLogger
protected $queries;
/**
- * @var \Symfony\Component\HttpKernel\Debug\Stopwatch
+ * @var Stopwatch
*/
protected $stopwatch;
@@ -22,6 +22,9 @@
"symfony/form": "2.2.*",
"propel/propel1": "1.6.*"
},
+ "require-dev": {
+ "symfony/stopwatch": "2.2.*"
+ },
"autoload": {
"psr-0": { "Symfony\\Bridge\\Propel1\\": "" }
},
@@ -6,7 +6,7 @@
<parameters>
<parameter key="debug.event_dispatcher.class">Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher</parameter>
- <parameter key="debug.stopwatch.class">Symfony\Component\HttpKernel\Debug\Stopwatch</parameter>
+ <parameter key="debug.stopwatch.class">Symfony\Component\Stopwatch\Stopwatch</parameter>
<parameter key="debug.container.dump">%kernel.cache_dir%/%kernel.container_class%.xml</parameter>
<parameter key="debug.controller_resolver.class">Symfony\Component\HttpKernel\Controller\TraceableControllerResolver</parameter>
</parameters>
@@ -23,6 +23,7 @@
"symfony/http-kernel": "2.2.*",
"symfony/filesystem": "2.2.*",
"symfony/routing": "2.2.*",
+ "symfony/stopwatch": "2.2.*",
"symfony/templating": "2.2.*",
"symfony/translation": "2.2.*",
"doctrine/common": ">=2.2,<2.4-dev"
@@ -14,7 +14,7 @@
use Symfony\Bundle\TwigBundle\TwigEngine;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
use Symfony\Component\Templating\TemplateNameParserInterface;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Config\FileLocatorInterface;
/**
@@ -19,6 +19,9 @@
"php": ">=5.3.3",
"symfony/twig-bridge": "2.2.*"
},
+ "require-dev": {
+ "symfony/stopwatch": "2.2.*"
+ },
"autoload": {
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
},
@@ -4,6 +4,7 @@ CHANGELOG
2.2.0
-----
+ * moved the Stopwatch classes to a new component
* added TraceableControllerResolver
* added TraceableEventDispatcher (removed ContainerAwareTraceableEventDispatcher)
* added support for WinCache opcode cache in ConfigDataCollector
@@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Controller;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Debug;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Profiler\Profile;
use Symfony\Component\HttpKernel\Profiler\Profiler;
@@ -15,10 +15,10 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Stopwatch\Stopwatch;
class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
{
@@ -28,7 +28,8 @@
"symfony/dependency-injection": "2.2.*",
"symfony/finder": "2.2.*",
"symfony/process": "2.2.*",
- "symfony/routing": "2.2.*"
+ "symfony/routing": "2.2.*",
+ "symfony/stopwatch": "2.2.*"
},
"suggest": {
"symfony/browser-kit": "2.2.*",
@@ -0,0 +1,2 @@
+Tests/ export-ignore
+phpunit.xml.dist export-ignore
@@ -0,0 +1 @@
+vendor/
@@ -0,0 +1,19 @@
+Copyright (c) 2004-2012 Fabien Potencier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,13 @@
+Stopwatch Component
+===================
+
+Stopwatch provides a way to profile code.
+
+Resources
+---------
+
+You can run the unit tests with the following command:
+
+ $ cd path/to/Symfony/Component/Stopwatch/
+ $ composer.phar install --dev
+ $ phpunit
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Debug;
+namespace Symfony\Component\Stopwatch;
/**
* Stopwatch provides a way to profile code.
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Debug;
+namespace Symfony\Component\Stopwatch;
/**
* Represents an Event managed by Stopwatch.
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Debug;
+namespace Symfony\Component\Stopwatch;
/**
* Represents an Period for an Event.
@@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Tests\Debug;
+namespace Symfony\Component\Stopwatch\Tests;
-use Symfony\Component\HttpKernel\Debug\StopwatchEvent;
+use Symfony\Component\Stopwatch\StopwatchEvent;
/**
* StopwatchEventTest
@@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\HttpKernel\Tests\Debug;
+namespace Symfony\Component\Stopwatch\Tests;
-use Symfony\Component\HttpKernel\Debug\Stopwatch;
+use Symfony\Component\Stopwatch\Stopwatch;
/**
* StopwatchTest
@@ -25,7 +25,7 @@ public function testStart()
$stopwatch = new Stopwatch();
$event = $stopwatch->start('foo', 'cat');
- $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
+ $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
$this->assertEquals('cat', $event->getCategory());
}
@@ -36,7 +36,7 @@ public function testStop()
usleep(20000);
$event = $stopwatch->stop('foo');
- $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
+ $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
$total = $event->getTotalTime();
$this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)');
}
@@ -50,7 +50,7 @@ public function testLap()
usleep(10000);
$stopwatch->stop('foo');
- $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event);
+ $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
$total = $event->getTotalTime();
$this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)');
}
@@ -0,0 +1,31 @@
+{
+ "name": "symfony/stopwatch",
+ "type": "library",
+ "description": "Symfony Stopwatch Component",
+ "keywords": [],
+ "homepage": "http://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "http://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "autoload": {
+ "psr-0": { "Symfony\\Component\\Stopwatch\\": "" }
+ },
+ "target-dir": "Symfony/Component/Stopwatch",
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.2-dev"
+ }
+ }
+}
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="vendor/autoload.php"
+>
+ <testsuites>
+ <testsuite name="Symfony Stopwatch Component Test Suite">
+ <directory>./Tests/</directory>
+ </testsuite>
+ </testsuites>
+
+ <filter>
+ <whitelist>
+ <directory>./</directory>
+ <exclude>
+ <directory>./Tests</directory>
+ <directory>./vendor</directory>
+ </exclude>
+ </whitelist>
+ </filter>
+</phpunit>

0 comments on commit 6b54a51

Please sign in to comment.