public function testFixNamespaceDeclarations()
    {
        $source = <<<EOF
<?php

namespace Foo;
class Foo {}
namespace   Bar ;
class Foo {}
namespace Foo\\Bar;
class Foo {}
namespace Foo\\Bar\\Bar
{
    class Foo {}
}
namespace
{
    class Foo {}
}
EOF;
        $expected = <<<EOF
<?php

namespace Foo
{
class Foo {}
}
namespace   Bar 
{
class Foo {}
}
namespace Foo\\Bar
{
class Foo {}
}
namespace Foo\\Bar\\Bar
{
    class Foo {}
}
namespace
{
    class Foo {}
}
EOF;
        $this->assertEquals($expected, ClassCollectionLoader::fixNamespaceDeclarations($source));
    }
Esempio n. 2
0
 /**
  * Boots the current kernel.
  *
  * This method boots the bundles, which MUST set
  * the DI container.
  *
  * @throws \LogicException When the Kernel is already booted
  */
 public function boot()
 {
     if (true === $this->booted) {
         throw new \LogicException('The kernel is already booted.');
     }
     if (!$this->isDebug()) {
         require_once __DIR__ . '/bootstrap.php';
     }
     $this->bundles = $this->registerBundles();
     $this->bundleDirs = $this->registerBundleDirs();
     $this->container = $this->initializeContainer();
     // load core classes
     ClassCollectionLoader::load($this->container->getParameter('kernel.compiled_classes'), $this->container->getParameter('kernel.cache_dir'), 'classes', $this->container->getParameter('kernel.debug'), true);
     foreach ($this->bundles as $bundle) {
         $bundle->setContainer($this->container);
         $bundle->boot();
     }
     $this->booted = true;
 }
Esempio n. 3
0
<?php

require_once __DIR__ . '/../../../HttpFoundation/UniversalClassLoader.php';
/*
 * This file is part of the Symfony framework.
 *
 * (c) Fabien Potencier <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
use Symfony\Component\HttpFoundation\UniversalClassLoader;
use Symfony\Component\HttpKernel\ClassCollectionLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => __DIR__ . '/../../../../..'));
$loader->register();
if (file_exists(__DIR__ . '/../../bootstrap.php')) {
    unlink(__DIR__ . '/../../bootstrap.php');
}
ClassCollectionLoader::load(array('Symfony\\Component\\HttpKernel\\Bundle\\Bundle', 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface', 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler', 'Symfony\\Component\\HttpKernel\\ClassCollectionLoader'), __DIR__ . '/../..', 'bootstrap', false);
Esempio n. 4
0
<?php

require_once __DIR__ . '/../../../HttpFoundation/UniversalClassLoader.php';
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Symfony\Component\HttpFoundation\UniversalClassLoader;
use Symfony\Component\HttpKernel\ClassCollectionLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => __DIR__ . '/../../../../..'));
$loader->register();
if (file_exists(__DIR__ . '/../../bootstrap.php')) {
    unlink(__DIR__ . '/../../bootstrap.php');
}
ClassCollectionLoader::load(array('Symfony\\Component\\HttpKernel\\Bundle\\Bundle', 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface', 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler', 'Symfony\\Component\\HttpKernel\\ClassCollectionLoader', 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionListener', 'Symfony\\Component\\DependencyInjection\\Container', 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface', 'Symfony\\Component\\DependencyInjection\\ContainerInterface', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface'), __DIR__ . '/../..', 'bootstrap', false);