From 38085c47a9c23f739dfa99bbe856a919ccf64b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Marseille?= Date: Mon, 1 Aug 2016 15:37:51 +0200 Subject: [PATCH] Avoid compiling some classes (#699) When using SiteRequestFactory in the front controller, there might be a cache generation problem: SiteRequest and SiteRequestInterface are loaded, and when the cache generated in CLI, which may contain the very same classes is loaded, leading to a conflict. --- DependencyInjection/SonataPageExtension.php | 2 -- .../SonataPageExtensionTest.php | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Tests/DependencyInjection/SonataPageExtensionTest.php diff --git a/DependencyInjection/SonataPageExtension.php b/DependencyInjection/SonataPageExtension.php index d9616423b..37abb136f 100644 --- a/DependencyInjection/SonataPageExtension.php +++ b/DependencyInjection/SonataPageExtension.php @@ -542,9 +542,7 @@ public function configureClassesToCompile() 'Sonata\\PageBundle\\Page\\Service\\PageServiceInterface', 'Sonata\\PageBundle\\Page\\TemplateManager', 'Sonata\\PageBundle\\Page\\TemplateManagerInterface', - 'Sonata\\PageBundle\\Request\\SiteRequest', 'Sonata\\PageBundle\\Request\\SiteRequestContext', - 'Sonata\\PageBundle\\Request\\SiteRequestInterface', 'Sonata\\PageBundle\\Route\\CmsPageRouter', 'Sonata\\PageBundle\\Site\\BaseSiteSelector', 'Sonata\\PageBundle\\Site\\HostPathSiteSelector', diff --git a/Tests/DependencyInjection/SonataPageExtensionTest.php b/Tests/DependencyInjection/SonataPageExtensionTest.php new file mode 100644 index 000000000..102a52c9f --- /dev/null +++ b/Tests/DependencyInjection/SonataPageExtensionTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\PageBundle\Tests\DependencyInjection; + +use Sonata\PageBundle\DependencyInjection\SonataPageExtension; + +/** + * Tests the SonataPageExtension. + * + * @author RĂ©mi Marseille + */ +class SonataPageExtensionTest extends \PHPUnit_Framework_TestCase +{ + /** + * Tests the configureClassesToCompile method. + */ + public function testConfigureClassesToCompile() + { + $extension = new SonataPageExtension(); + $extension->configureClassesToCompile(); + + $this->assertNotContains('Sonata\\PageBundle\\Request\\SiteRequest', $extension->getClassesToCompile()); + $this->assertNotContains('Sonata\\PageBundle\\Request\\SiteRequestInterface', $extension->getClassesToCompile()); + } +}