From 91dcca4c2fd4963805c27af8af608d2b62c7e814 Mon Sep 17 00:00:00 2001 From: Philipp Wahala Date: Thu, 4 Dec 2014 19:05:04 +0100 Subject: [PATCH] [HttpKernel] Remove unused method Kernel::isClassInActiveBundle Follow-up of #11869 --- src/Symfony/Component/HttpKernel/CHANGELOG.md | 1 + src/Symfony/Component/HttpKernel/Kernel.php | 18 ---------- .../Component/HttpKernel/KernelInterface.php | 13 ------- .../Tests/Fixtures/FooBarBundle.php | 19 ----------- .../Component/HttpKernel/Tests/KernelTest.php | 34 ------------------- 5 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index ad32deb12c81e..6b5d21bbc072a 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * Removed `Symfony\Component\HttpKernel\Kernel::init()` +* Removed `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle()` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle()` 2.6.0 ----- diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 5fe3da5d35d50..16bdd195168dc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -196,24 +196,6 @@ public function getBundles() return $this->bundles; } - /** - * {@inheritdoc} - * - * @api - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class) - { - foreach ($this->getBundles() as $bundle) { - if (0 === strpos($class, $bundle->getNamespace())) { - return true; - } - } - - return false; - } - /** * {@inheritdoc} * diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 04e5bd640a196..f691ddde8dab8 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -69,19 +69,6 @@ public function shutdown(); */ public function getBundles(); - /** - * Checks if a given class name belongs to an active bundle. - * - * @param string $class A class name - * - * @return bool true if the class belongs to an active bundle, false otherwise - * - * @api - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class); - /** * Returns a bundle and optionally its descendants by its name. * diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php deleted file mode 100644 index f940f83696134..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class FooBarBundle extends Bundle -{ - // We need a full namespaced bundle instance to test isClassInActiveBundle -} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 96c996528c85c..f8ce7859d01b0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -17,7 +17,6 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; -use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle; class KernelTest extends \PHPUnit_Framework_TestCase { @@ -279,39 +278,6 @@ public function doStuff() $this->assertEquals($expected, $output); } - public function testIsClassInActiveBundleFalse() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertFalse($kernel->isClassInActiveBundle('Not\In\Active\Bundle')); - } - - public function testIsClassInActiveBundleFalseNoNamespace() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertFalse($kernel->isClassInActiveBundle('NotNamespacedClass')); - } - - public function testIsClassInActiveBundleTrue() - { - $kernel = $this->getKernelMockForIsClassInActiveBundleTest(); - - $this->assertTrue($kernel->isClassInActiveBundle(__NAMESPACE__.'\Fixtures\FooBarBundle\SomeClass')); - } - - protected function getKernelMockForIsClassInActiveBundleTest() - { - $bundle = new FooBarBundle(); - - $kernel = $this->getKernel(array('getBundles')); - $kernel->expects($this->once()) - ->method('getBundles') - ->will($this->returnValue(array($bundle))); - - return $kernel; - } - public function testGetRootDir() { $kernel = new KernelForTest('test', true);