[HttpKernel] Remove unused method Kernel::isClassInActiveBundle

Follow-up of #11869
This commit is contained in:
Philipp Wahala 2014-12-04 19:05:04 +01:00
parent e0205ba1bc
commit 91dcca4c2f
5 changed files with 1 additions and 84 deletions

View File

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

View File

@ -196,24 +196,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface
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}
*

View File

@ -69,19 +69,6 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
*/
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.
*

View File

@ -1,19 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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
}

View File

@ -17,7 +17,6 @@ use Symfony\Component\HttpFoundation\Request;
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 @@ EOF;
$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);