You are here

protected function KernelTest::getBundle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/KernelTest.php \Symfony\Component\HttpKernel\Tests\KernelTest::getBundle()

Returns a mock for the BundleInterface.

Return value

BundleInterface

17 calls to KernelTest::getBundle()
KernelTest::testInitializeBundles in vendor/symfony/http-kernel/Tests/KernelTest.php
KernelTest::testInitializeBundlesSupportInheritanceCascade in vendor/symfony/http-kernel/Tests/KernelTest.php
KernelTest::testInitializeBundlesSupportsArbitraryBundleRegistrationOrder in vendor/symfony/http-kernel/Tests/KernelTest.php
KernelTest::testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtendedByTwoBundles in vendor/symfony/http-kernel/Tests/KernelTest.php
@expectedException \LogicException @expectedExceptionMessage Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle".
KernelTest::testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists in vendor/symfony/http-kernel/Tests/KernelTest.php
@expectedException \LogicException @expectedExceptionMessage Bundle "ChildCBundle" extends bundle "FooBar", which is not registered.

... See full list

File

vendor/symfony/http-kernel/Tests/KernelTest.php, line 773

Class

KernelTest

Namespace

Symfony\Component\HttpKernel\Tests

Code

protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) {
  $bundle = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface')
    ->setMethods(array(
    'getPath',
    'getParent',
    'getName',
  ))
    ->disableOriginalConstructor();
  if ($className) {
    $bundle
      ->setMockClassName($className);
  }
  $bundle = $bundle
    ->getMockForAbstractClass();
  $bundle
    ->expects($this
    ->any())
    ->method('getName')
    ->will($this
    ->returnValue(null === $bundleName ? get_class($bundle) : $bundleName));
  $bundle
    ->expects($this
    ->any())
    ->method('getPath')
    ->will($this
    ->returnValue($dir));
  $bundle
    ->expects($this
    ->any())
    ->method('getParent')
    ->will($this
    ->returnValue($parent));
  return $bundle;
}