From 23f3e80d8adefecf6987d3d59dfc92d36040485b Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 5 Aug 2014 00:15:09 +0200 Subject: [PATCH 1/5] Added specific symfony packages requirements --- composer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7f0bd8c..76a9f62 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,11 @@ } }, "require": { - "symfony/symfony": ">=2.3", + "symfony/http-kernel": "~2.3", + "symfony/dependency-injection": "~2.3", + "symfony/console": "~2.3", + "symfony/framework-bundle": "~2.3", + "egulias/listeners-debug": "1.0.*" }, From 65062f22a0f4c0b08a88c8a8047083733d1f1f37 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 5 Aug 2014 00:22:15 +0200 Subject: [PATCH 2/5] Normalized php files * Added all file headers and class headers * Sorted all use statements, grouped by Symfony and Egualias, alph, ascendent * Used fabot's php-cs-fixer to fix all php code --- Command/ListenersCommand.php | 21 +++++++++++++++------ EguliasListenersDebugCommandBundle.php | 12 ++++++++++++ Tests/Command/ListenersCommandTest.php | 19 +++++++++++++++++-- Tests/bootstrap.php | 7 +++++++ 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/Command/ListenersCommand.php b/Command/ListenersCommand.php index ea1ca1f..cfc109f 100644 --- a/Command/ListenersCommand.php +++ b/Command/ListenersCommand.php @@ -1,17 +1,25 @@ writeln(sprintf('This service is an alias for the service %s', (string) $definition)); + return; } diff --git a/EguliasListenersDebugCommandBundle.php b/EguliasListenersDebugCommandBundle.php index 8172c28..106f3b4 100644 --- a/EguliasListenersDebugCommandBundle.php +++ b/EguliasListenersDebugCommandBundle.php @@ -1,9 +1,21 @@ + */ class EguliasListenersDebugCommandBundle extends Bundle { } diff --git a/Tests/Command/ListenersCommandTest.php b/Tests/Command/ListenersCommandTest.php index bfb8fa8..afea8b4 100644 --- a/Tests/Command/ListenersCommandTest.php +++ b/Tests/Command/ListenersCommandTest.php @@ -1,14 +1,29 @@ + */ +class ListenersCommandTest extends PHPUnit_Framework_TestCase { protected $application; diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index ca483df..b2059ae 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -1,5 +1,12 @@ Date: Tue, 5 Aug 2014 00:51:50 +0200 Subject: [PATCH 3/5] Allow phpunit >=3.7 as dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 76a9f62..bf1188f 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ }, "require-dev": { - "phpunit/phpunit": "4.0.*", + "phpunit/phpunit": ">=3.7", "satooshi/php-coveralls": "dev-master" }, "autoload": { From 604ea4d23ea169fff945c2cafcc7b3d2b1d50b6b Mon Sep 17 00:00:00 2001 From: Eduardo Gulias Davis Date: Sun, 10 Aug 2014 20:06:38 +0200 Subject: [PATCH 4/5] #25 - Removed unnesary components from the container xml. Removed tests from being part of the coverage --- Tests/Command/ListenersCommandTest.php | 4 +- Tests/DummyListener.php | 18 + Tests/appDevDebugProjectContainer.xml | 2618 +----------------------- phpunit.xml | 1 + 4 files changed, 25 insertions(+), 2616 deletions(-) create mode 100644 Tests/DummyListener.php diff --git a/Tests/Command/ListenersCommandTest.php b/Tests/Command/ListenersCommandTest.php index afea8b4..772398e 100644 --- a/Tests/Command/ListenersCommandTest.php +++ b/Tests/Command/ListenersCommandTest.php @@ -52,10 +52,10 @@ public function testBaseCommand() public function testEventNameFilter() { - $display = $this->executeCommand(array('name' => 'acme.demo.listener')); + $display = $this->executeCommand(array('name' => 'dummy_listener')); $this->assertRegExp('/Class/', $display); - $this->assertRegExp('/ControllerListener/', $display); + $this->assertRegExp('/DummyListener/', $display); } public function testFilterByEventName() diff --git a/Tests/DummyListener.php b/Tests/DummyListener.php new file mode 100644 index 0000000..7a6a592 --- /dev/null +++ b/Tests/DummyListener.php @@ -0,0 +1,18 @@ + 'listen'); + } + + public function listen() + { + + } +} diff --git a/Tests/appDevDebugProjectContainer.xml b/Tests/appDevDebugProjectContainer.xml index 6a42d64..8e82dc5 100644 --- a/Tests/appDevDebugProjectContainer.xml +++ b/Tests/appDevDebugProjectContainer.xml @@ -7,2623 +7,13 @@ app /home/eduardo/workspace/sf/app/cache/dev /home/eduardo/workspace/sf/app/logs - - Symfony\Bundle\FrameworkBundle\FrameworkBundle - Symfony\Bundle\SecurityBundle\SecurityBundle - Symfony\Bundle\TwigBundle\TwigBundle - Symfony\Bundle\MonologBundle\MonologBundle - Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle - Symfony\Bundle\AsseticBundle\AsseticBundle - Doctrine\Bundle\DoctrineBundle\DoctrineBundle - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle - Acme\DemoBundle\AcmeDemoBundle - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle - Sensio\Bundle\DistributionBundle\SensioDistributionBundle - Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle - - UTF-8 - appDevDebugProjectContainer - pdo_mysql - 127.0.0.1 - null - symfony - root - null - smtp - 127.0.0.1 - null - null - en - ThisTokenIsNotSoSecretChangeIt - Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver - Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser - Symfony\Component\HttpKernel\EventListener\ResponseListener - Symfony\Component\HttpKernel\EventListener\StreamedResponseListener - Symfony\Component\HttpKernel\EventListener\LocaleListener - Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher - Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel - Symfony\Component\Filesystem\Filesystem - Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate - Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer - Symfony\Component\HttpKernel\Config\FileLocator - Symfony\Component\HttpKernel\UriSigner - Symfony\Component\HttpFoundation\RequestStack - Symfony\Component\HttpKernel\Fragment\FragmentHandler - Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer - Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer - null - Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer - /_fragment - Symfony\Bundle\FrameworkBundle\Translation\Translator - Symfony\Component\Translation\IdentityTranslator - Symfony\Component\Translation\MessageSelector - Symfony\Component\PropertyAccess\PropertyAccessor - Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener - Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher - Symfony\Component\Stopwatch\Stopwatch - /home/eduardo/workspace/sf/app/cache/dev/appDevDebugProjectContainer.xml - Symfony\Component\HttpKernel\Controller\TraceableControllerResolver - ThisTokenIsNotSoSecretChangeIt - true - - - en - Symfony\Component\HttpFoundation\Session\Session - Symfony\Component\HttpFoundation\Session\Flash\FlashBag - Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - Symfony\Component\HttpFoundation\Session\Storage\MetadataBag - _sf2_meta - Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage - Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage - Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage - Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler - Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler - Symfony\Bundle\FrameworkBundle\EventListener\SessionListener - - /home/eduardo/workspace/sf/app/cache/dev/sessions - 0 - Symfony\Component\Security\Core\Util\SecureRandom - Symfony\Component\Form\ResolvedFormTypeFactory - Symfony\Component\Form\FormRegistry - Symfony\Component\Form\FormFactory - Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension - Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser - true - _token - Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator - Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage - Symfony\Component\Security\Csrf\CsrfTokenManager - Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine - Symfony\Bundle\FrameworkBundle\Templating\TimedPhpEngine - null - - twig - - Symfony\Component\Validator\Validator - Symfony\Component\Validator\Mapping\ClassMetadataFactory - Symfony\Component\Validator\Mapping\Cache\ApcCache - - Symfony\Component\Validator\Mapping\Loader\LoaderChain - Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader - Symfony\Component\Validator\Mapping\Loader\AnnotationLoader - Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader - Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader - Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/config/validation.xml - - - Symfony\Component\Validator\Constraints\ExpressionValidator - validators - Symfony\Component\HttpKernel\EventListener\FragmentListener - Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeFactoryDataCollectorProxy - Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension - Symfony\Component\HttpKernel\Profiler\Profiler - Symfony\Component\HttpKernel\EventListener\ProfilerListener - Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector - Symfony\Component\HttpKernel\DataCollector\RequestDataCollector - Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector - Symfony\Component\HttpKernel\DataCollector\EventDataCollector - Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector - Symfony\Component\HttpKernel\DataCollector\TimeDataCollector - Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector - Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector - Symfony\Component\Form\Extension\DataCollector\FormDataCollector - Symfony\Component\Form\Extension\DataCollector\FormDataExtractor - false - false - file:/home/eduardo/workspace/sf/app/cache/dev/profiler - - - 86400 - Symfony\Bundle\FrameworkBundle\Routing\Router - Symfony\Component\Routing\RequestContext - Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader - Symfony\Component\Config\Loader\LoaderResolver - Symfony\Component\Routing\Loader\XmlFileLoader - Symfony\Component\Routing\Loader\YamlFileLoader - Symfony\Component\Routing\Loader\PhpFileLoader - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper - Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer - appDevUrlMatcher - appDevUrlGenerator - Symfony\Component\HttpKernel\EventListener\RouterListener - localhost - http - - /home/eduardo/workspace/sf/app/cache/dev/assetic/routing.yml - appDev - 80 - 443 - Doctrine\Common\Annotations\AnnotationReader - Doctrine\Common\Annotations\CachedReader - Doctrine\Common\Annotations\FileCacheReader - Symfony\Component\Security\Core\SecurityContext - Symfony\Component\Security\Core\User\UserChecker - Symfony\Component\Security\Core\Encoder\EncoderFactory - Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder - Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder - Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder - Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder - Symfony\Component\Security\Core\User\InMemoryUserProvider - Symfony\Component\Security\Core\User\User - Symfony\Component\Security\Core\User\ChainUserProvider - Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver - Symfony\Component\Security\Core\Authentication\Token\AnonymousToken - Symfony\Component\Security\Core\Authentication\Token\RememberMeToken - Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager - Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy - Symfony\Component\Security\Core\Authorization\AccessDecisionManager - Symfony\Component\Security\Core\Authorization\Voter\RoleVoter - Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter - Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter - Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter - Symfony\Component\Security\Http\Firewall - Symfony\Bundle\SecurityBundle\Security\FirewallMap - Symfony\Bundle\SecurityBundle\Security\FirewallContext - Symfony\Component\HttpFoundation\RequestMatcher - Symfony\Component\HttpFoundation\ExpressionRequestMatcher - Symfony\Component\Security\Core\Role\RoleHierarchy - Symfony\Component\Security\Http\HttpUtils - Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator - Symfony\Component\Security\Core\Authorization\ExpressionLanguage - Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint - Symfony\Component\Security\Http\Firewall\ChannelListener - Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint - Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener - Symfony\Component\Security\Http\Firewall\SimpleFormAuthenticationListener - Symfony\Component\Security\Http\Firewall\SimplePreAuthenticationListener - Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener - Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint - Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener - Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint - Symfony\Component\Security\Http\Firewall\X509AuthenticationListener - Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener - Symfony\Component\Security\Http\Firewall\SwitchUserListener - Symfony\Component\Security\Http\Firewall\LogoutListener - Symfony\Component\Security\Http\Logout\SessionLogoutHandler - Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler - Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler - Symfony\Component\Security\Http\Firewall\AccessListener - Symfony\Component\Security\Http\AccessMap - Symfony\Component\Security\Http\Firewall\ExceptionListener - Symfony\Component\Security\Http\Firewall\ContextListener - Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider - Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider - Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider - Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider - Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler - Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler - Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler - Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider - Symfony\Component\Security\Http\Firewall\RememberMeListener - Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider - Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices - Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices - Symfony\Component\Security\Http\RememberMe\ResponseListener - Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper - Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper - Symfony\Bundle\SecurityBundle\Twig\Extension\LogoutUrlExtension - Symfony\Bridge\Twig\Extension\SecurityExtension - Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector - null - true - migrate - false - true - - - ROLE_USER - - - ROLE_USER - ROLE_ADMIN - ROLE_ALLOWED_TO_SWITCH - - - Twig_Environment - Symfony\Bundle\TwigBundle\Loader\FilesystemLoader - Twig_Loader_Chain - Symfony\Bundle\TwigBundle\TwigEngine - Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer - Symfony\Bridge\Twig\Extension\TranslationExtension - Symfony\Bundle\TwigBundle\Extension\AssetsExtension - Symfony\Bundle\TwigBundle\Extension\ActionsExtension - Symfony\Bridge\Twig\Extension\CodeExtension - Symfony\Bridge\Twig\Extension\RoutingExtension - Symfony\Bridge\Twig\Extension\YamlExtension - Symfony\Bridge\Twig\Extension\FormExtension - Symfony\Bridge\Twig\Extension\HttpKernelExtension - Symfony\Bridge\Twig\Extension\StopwatchExtension - Symfony\Bridge\Twig\Extension\ExpressionExtension - Symfony\Bridge\Twig\Form\TwigRendererEngine - Symfony\Bridge\Twig\Form\TwigRenderer - Symfony\Bridge\Twig\Translation\TwigExtractor - Symfony\Component\HttpKernel\EventListener\ExceptionListener - Symfony\Bundle\TwigBundle\Controller\ExceptionController - twig.controller.exception:showAction - - form_div_layout.html.twig - - Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine - - true - true - twig.controller.exception:showAction - null - null - /home/eduardo/workspace/sf/app/cache/dev/twig - UTF-8 - - - Symfony\Bridge\Monolog\Logger - Swift_Mailer - Symfony\Bundle\AsseticBundle\Factory\AssetFactory - Assetic\Factory\LazyAssetManager - Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer - Assetic\Factory\Loader\CachedFormulaLoader - Assetic\Cache\ConfigCache - Symfony\Bundle\AsseticBundle\Factory\Loader\ConfigurationLoader - Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource - Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource - Symfony\Bundle\AsseticBundle\Factory\Resource\DirectoryResource - Symfony\Bundle\AsseticBundle\FilterManager - Assetic\Factory\Worker\EnsureFilterWorker - Symfony\Bundle\AsseticBundle\DefaultValueSupplier - - /home/eduardo/workspace/sf/app/cache/dev/assetic - - Symfony\Bundle\AsseticBundle\Twig\AsseticExtension - Assetic\Extension\Twig\TwigFormulaLoader - Symfony\Bundle\AsseticBundle\Templating\DynamicAsseticHelper - Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper - Symfony\Bundle\AsseticBundle\Factory\Loader\AsseticHelperFormulaLoader - true - true - false - /home/eduardo/workspace/sf/app/../web - /home/eduardo/workspace/sf/app/../web - - /usr/bin/java - /usr/bin/node - /usr/bin/ruby - /usr/bin/sass - Assetic\Filter\CssRewriteFilter - - Symfony\Bundle\AsseticBundle\Controller\AsseticController - Symfony\Bundle\AsseticBundle\Routing\AsseticLoader - Assetic\Cache\FilesystemCache - Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker - Symfony\Bundle\AsseticBundle\EventListener\RequestListener - Doctrine\DBAL\Logging\LoggerChain - Doctrine\DBAL\Logging\DebugStack - Symfony\Bridge\Doctrine\Logger\DbalLogger - Doctrine\DBAL\Configuration - Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector - Symfony\Bridge\Doctrine\ContainerAwareEventManager - Doctrine\Bundle\DoctrineBundle\ConnectionFactory - Doctrine\DBAL\Event\Listeners\MysqlSessionInit - Doctrine\DBAL\Event\Listeners\OracleSessionInit - Doctrine\Bundle\DoctrineBundle\Registry - - doctrine.orm.default_entity_manager - - default - - - doctrine.dbal.default_connection - - default - Doctrine\ORM\Configuration - Doctrine\ORM\EntityManager - Doctrine\Bundle\DoctrineBundle\ManagerConfigurator - Doctrine\Common\Cache\ArrayCache - Doctrine\Common\Cache\ApcCache - Doctrine\Common\Cache\MemcacheCache - localhost - 11211 - Memcache - Doctrine\Common\Cache\MemcachedCache - localhost - 11211 - Memcached - Doctrine\Common\Cache\RedisCache - localhost - 6379 - Redis - Doctrine\Common\Cache\XcacheCache - Doctrine\Common\Cache\WinCacheCache - Doctrine\Common\Cache\ZendDataCache - Doctrine\ORM\Mapping\Driver\DriverChain - Doctrine\ORM\Mapping\Driver\AnnotationDriver - Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver - Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver - Doctrine\ORM\Mapping\Driver\PHPDriver - Doctrine\ORM\Mapping\Driver\StaticPHPDriver - Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer - Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator - Symfony\Bridge\Doctrine\Validator\DoctrineInitializer - Symfony\Bridge\Doctrine\Security\User\EntityUserProvider - Doctrine\ORM\Tools\ResolveTargetEntityListener - Doctrine\ORM\Mapping\DefaultNamingStrategy - Doctrine\ORM\Mapping\UnderscoreNamingStrategy - true - /home/eduardo/workspace/sf/app/cache/dev/doctrine/orm/Proxies - Proxies - Sensio\Bundle\FrameworkExtraBundle\Templating\TemplateGuesser - Symfony\Component\Routing\Loader\AnnotationDirectoryLoader - Symfony\Component\Routing\Loader\AnnotationFileLoader - Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader - Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager - Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter - Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DateTimeParamConverter - Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController - Symfony\Bundle\WebProfilerBundle\Controller\RouterController - Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController - bottom - Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener - false - 2 - Sensio\Bundle\DistributionBundle\Configurator\Configurator - - - config - @WebProfiler/Collector/config.html.twig - - - request - @WebProfiler/Collector/request.html.twig - - - exception - @WebProfiler/Collector/exception.html.twig - - - events - @WebProfiler/Collector/events.html.twig - - - logger - @WebProfiler/Collector/logger.html.twig - - - time - @WebProfiler/Collector/time.html.twig - - - memory - @WebProfiler/Collector/memory.html.twig - - - router - @WebProfiler/Collector/router.html.twig - - - form - @WebProfiler/Collector/form.html.twig - - - security - @Security/Collector/security.html.twig - - - swiftmailer - @Swiftmailer/Collector/swiftmailer.html.twig - - - db - DoctrineBundle:Collector:db - - - - - - + + - - - UTF-8 + + - - - - - - en - - - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/app/Resources - - - - - - - - - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/app/Resources - - - - - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/app/Resources - - - ThisTokenIsNotSoSecretChangeIt - - - - true - - - - - - - - - - - - - - - - - /_fragment - - - - - - - null - - /_fragment - - - - - null - - - /_fragment - - - - - - - - php - - - yml - - - xlf - xliff - - - po - - - mo - - - ts - - - csv - - - res - - - dat - - - ini - - - - - - /home/eduardo/workspace/sf/app/cache/dev/translations - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - php - - - - yml - - - - xlf - - - - xliff - - - - po - - - - mo - - - - ts - - - - csv - - - - res - - - - dat - - - - ini - - - - json - - - - - - php - - - - twig - - - - - - php - - - - xlf - - - - po - - - - mo - - - - yml - - - - ts - - - - csv - - - - ini - - - - json - - - - res - - - - - - - - emergency - - - - - - - - - - - - - - kernel.controller - - data_collector.router - onKernelController - - 0 - - - kernel.request - - assetic.request_listener - onKernelRequest - - 0 - - - kernel.controller - - acme.demo.listener - onKernelController - - 0 - - - response_listener - Symfony\Component\HttpKernel\EventListener\ResponseListener - - - streamed_response_listener - Symfony\Component\HttpKernel\EventListener\StreamedResponseListener - - - locale_listener - Symfony\Component\HttpKernel\EventListener\LocaleListener - - - debug.emergency_logger_listener - Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener - - - debug.deprecation_logger_listener - Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener - - - session_listener - Symfony\Bundle\FrameworkBundle\EventListener\SessionListener - - - fragment.listener - Symfony\Component\HttpKernel\EventListener\FragmentListener - - - profiler_listener - Symfony\Component\HttpKernel\EventListener\ProfilerListener - - - data_collector.request - Symfony\Component\HttpKernel\DataCollector\RequestDataCollector - - - router_listener - Symfony\Component\HttpKernel\EventListener\RouterListener - - - security.firewall - Symfony\Component\Security\Http\Firewall - - - security.rememberme.response_listener - Symfony\Component\Security\Http\RememberMe\ResponseListener - - - twig.exception_listener - Symfony\Component\HttpKernel\EventListener\ExceptionListener - - - web_profiler.debug_toolbar - Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener - - - - - - - - - - - - - - - - - deprecation - - - - - - - - - - - - - _sf2_meta - 0 - - - - null - - - - null - - - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/secure_random.seed - - - - - - - - - - - - - - - form.type.form - form.type.birthday - form.type.checkbox - form.type.choice - form.type.collection - form.type.country - form.type.date - form.type.datetime - form.type.email - form.type.file - form.type.hidden - form.type.integer - form.type.language - form.type.locale - form.type.money - form.type.number - form.type.password - form.type.percent - form.type.radio - form.type.repeated - form.type.search - form.type.textarea - form.type.text - form.type.time - form.type.timezone - form.type.url - form.type.button - form.type.submit - form.type.reset - form.type.currency - form.type.entity - - - - form.type_extension.form.http_foundation - form.type_extension.form.validator - form.type_extension.csrf - form.type_extension.form.data_collector - - - form.type_extension.repeated.validator - - - form.type_extension.submit.validator - - - - form.type_guesser.validator - form.type_guesser.doctrine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - _token - - validators - - - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/app/cache/dev - - - - - - - - - - null - %%s?%%s - - - - - - - - - - - - - - - - - - - - - - - - - - null - /home/eduardo/workspace/sf/app - UTF-8 - - - - - - - - - - - - - - FrameworkBundle:Form - - - - - - - - - - - - - - - - - - - - - validator.expression - security.validator.user_password - doctrine.orm.validator.unique - - - - - validators - - - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/config/validation.xml - - - - - - - - - - - - null - - - - - - - - - /_fragment - - - - - - - - - - file:/home/eduardo/workspace/sf/app/cache/dev/profiler - - - 86400 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default - - - - - - - - - - null - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GET - localhost - http - 80 - 443 - - - - - - - - - - - - - false - - - - - - - - - - secured_area - - true - - - - true - - - - - - Symfony\Component\Security\Core\Authentication\Token\AnonymousToken - Symfony\Component\Security\Core\Authentication\Token\RememberMeToken - - - - - - - - - - - - - - - - - - - - - - - - - - - affirmative - false - true - - - - - ROLE_USER - - - ROLE_USER - ROLE_ADMIN - ROLE_ALLOWED_TO_SWITCH - - - - - - - - - - - - ^/(_(profiler|wdt)|css|images|js)/ - - - - - ^/demo/secured/login$ - - - - - ^/demo/secured/ - - - - - - - - - - - - - - - - - - - - - secured_area - _demo_logout - logout - _csrf_token - null - - - - - - - - - - - user - userpass - - ROLE_USER - - - - - - - - admin - adminpass - - ROLE_ADMIN - - - - - - - - null - - - - null - - - - - - - - - - - - 80 - 443 - - - - - - - - - - - - secured_area - - - - - - - - - - - - - - - - - - - - - - _demo - - - - _csrf_token - logout - _demo_logout - - - - - - - - - - - - - - - - migrate - - - - - - - - - secured_area - - - - - - - - - - _demo_login - false - / - _target_path - false - - - secured_area - - - - - - - - - - - - - - _demo_login - null - false - _failure_path - - - - - - _security_check - false - true - _username - _password - _csrf_token - authenticate - true - - - - null - - - - - - - - - - - - - - - - - - - - - - - - - secured_area - - - - - - - - - - _demo_login - false - - - null - null - - - - - - - - true - true - twig.controller.exception:showAction - null - null - /home/eduardo/workspace/sf/app/cache/dev/twig - UTF-8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - null - /home/eduardo/workspace/sf/app - UTF-8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - form_div_layout.html.twig - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - app - - - - - - - - - - - twig.controller.exception:showAction - - - - - true - - - - - - - - - - - - assetic.filter.cssrewrite - - - - - - - - - - - - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/assetic/config - - - true - - - - - - - - - - - /home/eduardo/workspace/sf/app/Resources/views - /\.[^.]+\.twig$/ - - - twig - - - - - - - - - /home/eduardo/workspace/sf/app/../web - true - - - - - - - - - - - - - - - - - - - false - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/assetic/assets - - - - - - - - - - - doctrine.dbal.default_connection - - - doctrine.orm.default_entity_manager - - default - default - - - - - pdo_mysql - 127.0.0.1 - null - symfony - root - null - UTF8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sf2orm_default_2b8030e2b49312ce2028b37a77ad04a61f4323c995806d6576f096b1b923c3d6 - - - - - - - - - sf2orm_default_2b8030e2b49312ce2028b37a77ad04a61f4323c995806d6576f096b1b923c3d6 - - - - - - - - - sf2orm_default_2b8030e2b49312ce2028b37a77ad04a61f4323c995806d6576f096b1b923c3d6 - - - - - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/doctrine/orm/Proxies - - - Proxies - - - true - - - Doctrine\ORM\Mapping\ClassMetadataFactory - - - Doctrine\ORM\EntityRepository - - - - - - - - - - - - - - - - - 0 - doctrine.orm - - - - 0 - datetime - - - - - - - - - - - - - - - - - - - - - - - - config - @WebProfiler/Collector/config.html.twig - - - request - @WebProfiler/Collector/request.html.twig - - - exception - @WebProfiler/Collector/exception.html.twig - - - events - @WebProfiler/Collector/events.html.twig - - - logger - @WebProfiler/Collector/logger.html.twig - - - time - @WebProfiler/Collector/time.html.twig - - - memory - @WebProfiler/Collector/memory.html.twig - - - router - @WebProfiler/Collector/router.html.twig - - - form - @WebProfiler/Collector/form.html.twig - - - security - @Security/Collector/security.html.twig - - - swiftmailer - @Swiftmailer/Collector/swiftmailer.html.twig - - - db - DoctrineBundle:Collector:db - - - bottom - - - - - - - - - - true - - - - - false - 2 - bottom - - - - /home/eduardo/workspace/sf/app - - - request - - - - - - - - - - - - emergency - - - - - - - - - - - - event - - - - - - - - - - - - deprecation - - - - - - - - - - - - security - - - - - - - - - - - - templating - - - - - - - - - - - - profiler - - - - - - - - - - - - router - - - - - - - - - - - - doctrine - - - - - - - - - - - - 100 - true - - - /home/eduardo/workspace/sf/app/cache/dev/sessions - MOCKSESSID - - - - - - - - - - - - - UTF-8 - - - - templating.helper.slots - templating.helper.assets - templating.helper.request - templating.helper.session - templating.helper.router - templating.helper.actions - templating.helper.code - templating.helper.translator - templating.helper.form - templating.helper.stopwatch - templating.helper.logout_url - templating.helper.security - assetic.helper.dynamic - - - - - - - - - - - - guessDefaultEscapingStrategy - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/assetic/routing.yml - - /home/eduardo/workspace/sf/app/cache/dev - true - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\UrlGenerator - Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper - appDevUrlGenerator - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher - Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper - appDevUrlMatcher - true - - - - - - - - - /home/eduardo/workspace/sf/app/cache/dev/annotations - true - - - - - %security.encoder.plain.class% - - false - - - - - - - - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views - Framework - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/views - Security - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views - Twig - - - /home/eduardo/workspace/sf/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/Resources/views - Swiftmailer - - - /home/eduardo/workspace/sf/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views - Doctrine - - - /home/eduardo/workspace/sf/src/Acme/DemoBundle/Resources/views - AcmeDemo - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views - WebProfiler - - - /home/eduardo/workspace/sf/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views - SensioDistribution - - - /home/eduardo/workspace/sf/app/Resources/views - - - /home/eduardo/workspace/sf/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form - - - - app - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - null - - - null - - - null - - - - - - - 127.0.0.1 - - - 25 - - - null - - - 30 - - - null - - - - - - - - - - - - - - diff --git a/phpunit.xml b/phpunit.xml index 7c61e56..99a4c96 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -21,6 +21,7 @@ ./vendor + ./Tests From 6427dec2ce18446649686768e560927fc5e2fd3e Mon Sep 17 00:00:00 2001 From: Eduardo Gulias Davis Date: Sun, 10 Aug 2014 20:45:34 +0200 Subject: [PATCH 5/5] #25 - Improved tests and subscriber definition --- Command/ListenersCommand.php | 12 +++---- Tests/Command/ListenersCommandTest.php | 44 +++++++++++++++++++++++++- Tests/DummyListener.php | 11 ++----- Tests/DummySubscriber.php | 22 +++++++++++++ Tests/appDevDebugProjectContainer.xml | 8 +++-- 5 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 Tests/DummySubscriber.php diff --git a/Command/ListenersCommand.php b/Command/ListenersCommand.php index cfc109f..391c788 100644 --- a/Command/ListenersCommand.php +++ b/Command/ListenersCommand.php @@ -154,10 +154,6 @@ protected function outputListener(OutputInterface $output, $serviceId) $output->writeln(sprintf('Listener Id %s', $serviceId)); $output->writeln(sprintf('Class %s', $definition->getClass())); - if ($definition instanceof Definition) { - return; - } - $type = ($fetcher->isSubscriber($definition)) ? 'subscriber' : 'listener'; $output->writeln(sprintf('Type %s', $type)); $output->writeln(sprintf('Listens to', '')); @@ -165,8 +161,8 @@ protected function outputListener(OutputInterface $output, $serviceId) $tags = $definition->getTags(); foreach ($tags as $tag => $details) { - if (preg_match(self::SUBSCRIBER_PATTERN, $tag)) { - $subscribed = $this->getEventSubscriberInformation($definition->getClass()); + if (preg_match(ListenerFetcher::SUBSCRIBER_PATTERN, $tag)) { + $subscribed = $fetcher->getEventSubscriberInformation($definition->getClass()); foreach ($subscribed as $name => $current) { //Exception when event only has the method name if (!is_array($current)) { @@ -178,12 +174,14 @@ protected function outputListener(OutputInterface $output, $serviceId) $event['name'] = $name; $event['method'] = $current[0]; $event['priority'] = (isset($current[1])) ? $current[1] : 0; + $events[] = $event; } - } elseif (preg_match(self::LISTENER_PATTERN, $tag)) { + } elseif (preg_match(ListenerFetcher::LISTENER_PATTERN, $tag)) { foreach ($details as $current) { $event['name'] = $current['event']; $event['method'] = (isset($current['method'])) ? $current['method'] : $current['event']; $event['priority'] = isset($current['priority']) ? $current['priority'] : 0; + $events[] = $event; } } } diff --git a/Tests/Command/ListenersCommandTest.php b/Tests/Command/ListenersCommandTest.php index 772398e..deaac2c 100644 --- a/Tests/Command/ListenersCommandTest.php +++ b/Tests/Command/ListenersCommandTest.php @@ -50,12 +50,41 @@ public function testBaseCommand() $this->assertRegExp('/Class Name/', $display); } - public function testEventNameFilter() + public function testEventNameFilterForListener() { $display = $this->executeCommand(array('name' => 'dummy_listener')); $this->assertRegExp('/Class/', $display); $this->assertRegExp('/DummyListener/', $display); + $this->assertRegExp('/Event/', $display); + $this->assertRegExp('/Method/', $display); + $this->assertRegExp('/Type/', $display); + $this->assertRegExp('/Priority/', $display); + $this->assertRegExp('/listener/', $display); + $this->assertRegExp('/listen/', $display); + $this->assertRegExp('/8/', $display); + } + + public function testEventNameFilterForSubscriber() + { + $display = $this->executeCommand(array('name' => 'dummy_listener_subscriber')); + + $this->assertRegExp('/Class/', $display); + $this->assertRegExp('/DummySubscriber/', $display); + $this->assertRegExp('/Event/', $display); + $this->assertRegExp('/Method/', $display); + $this->assertRegExp('/Priority/', $display); + $this->assertRegExp('/Type/', $display); + $this->assertRegExp('/subscriber/', $display); + $this->assertRegExp('/listen/', $display); + $this->assertRegExp('/8/', $display); + } + + public function testEventNameFilterForAlias() + { + $display = $this->executeCommand(array('name' => 'dummy_listener_subscriber_alias')); + + $this->assertRegExp('/alias for the service dummy_listener_subscriber/', $display); } public function testFilterByEventName() @@ -78,6 +107,19 @@ public function testShowOnlySubscribers() $this->assertNotRegExp('/\|listener\|/', $display); } + + public function testShowPrivate() + { + $display = $this->executeCommand(array('--show-private' => null)); + + $this->assertNotRegExp('/\|private\|/', $display); + } + + public function testShowOnlyOneListener() + { + + } + private function executeCommand(array $options) { $command = $this->application->find('container:debug:listeners'); diff --git a/Tests/DummyListener.php b/Tests/DummyListener.php index 7a6a592..a87d054 100644 --- a/Tests/DummyListener.php +++ b/Tests/DummyListener.php @@ -1,16 +1,9 @@ 'listen'); - } - public function listen() { diff --git a/Tests/DummySubscriber.php b/Tests/DummySubscriber.php new file mode 100644 index 0000000..eda4a59 --- /dev/null +++ b/Tests/DummySubscriber.php @@ -0,0 +1,22 @@ + array('listen', 8), + 'rare.condition' => array(array('listen', 8)) + ); + } + + public function listen() + { + + } +} diff --git a/Tests/appDevDebugProjectContainer.xml b/Tests/appDevDebugProjectContainer.xml index 8e82dc5..06705a0 100644 --- a/Tests/appDevDebugProjectContainer.xml +++ b/Tests/appDevDebugProjectContainer.xml @@ -9,11 +9,15 @@ /home/eduardo/workspace/sf/app/logs - + + - + + + +