merged branch fabpot/stopwatch-component (PR #5952)

This PR was merged into the master branch.

Commits
-------

6b54a51 moved the Stopwatch classes to their own component

Discussion
----------

moved the Stopwatch classes to their own component

see https://github.com/symfony/symfony/issues/5911

---------------------------------------------------------------------------

by stof at 2012-11-09T08:06:06Z

you should also add the ``.gitattributes`` in the new component

---------------------------------------------------------------------------

by fabpot at 2012-11-09T09:09:35Z

@stof: I've added the .gitattributes file, but also the phpunit and LICENSE ones.

---------------------------------------------------------------------------

by dlsniper at 2012-11-09T13:51:23Z

Also you should add this to the changelog/update files. I'll do it myself but only in about 8 hours or so as I'm not at home.
This commit is contained in:
Fabien Potencier 2012-11-09 14:58:13 +01:00
commit 7ed728a894
24 changed files with 126 additions and 19 deletions

View File

@ -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;
/**

View File

@ -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.*",

View File

@ -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;

View File

@ -22,6 +22,9 @@
"symfony/form": "2.2.*",
"propel/propel1": "1.6.*"
},
"require-dev": {
"symfony/stopwatch": "2.2.*"
},
"autoload": {
"psr-0": { "Symfony\\Bridge\\Propel1\\": "" }
},

View File

@ -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>

View File

@ -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"

View File

@ -14,7 +14,7 @@ namespace Symfony\Bundle\TwigBundle\Debug;
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;
/**

View File

@ -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\\": "" }
},

View File

@ -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

View File

@ -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;
/**

View File

@ -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;

View File

@ -15,10 +15,10 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
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
{

View File

@ -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.*",

View File

@ -0,0 +1,2 @@
Tests/ export-ignore
phpunit.xml.dist export-ignore

View File

@ -0,0 +1 @@
vendor/

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
$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 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
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 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
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)');
}

View File

@ -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"
}
}
}

View File

@ -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>