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:
commit
7ed728a894
@ -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 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -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\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
|
||||
{
|
||||
|
@ -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.*",
|
||||
|
2
src/Symfony/Component/Stopwatch/.gitattributes
vendored
Normal file
2
src/Symfony/Component/Stopwatch/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
Tests/ export-ignore
|
||||
phpunit.xml.dist export-ignore
|
1
src/Symfony/Component/Stopwatch/.gitignore
vendored
Normal file
1
src/Symfony/Component/Stopwatch/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
vendor/
|
19
src/Symfony/Component/Stopwatch/LICENSE
Normal file
19
src/Symfony/Component/Stopwatch/LICENSE
Normal 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.
|
13
src/Symfony/Component/Stopwatch/README.md
Normal file
13
src/Symfony/Component/Stopwatch/README.md
Normal 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
|
@ -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 @@ 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)');
|
||||
}
|
31
src/Symfony/Component/Stopwatch/composer.json
Normal file
31
src/Symfony/Component/Stopwatch/composer.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
29
src/Symfony/Component/Stopwatch/phpunit.xml.dist
Normal file
29
src/Symfony/Component/Stopwatch/phpunit.xml.dist
Normal 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>
|
Reference in New Issue
Block a user