2011-03-05 23:15:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2011-03-05 23:15:01 +00:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Symfony\Tests\Component\HttpKernel\DataCollector;
|
|
|
|
|
|
|
|
use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector;
|
|
|
|
use Symfony\Component\HttpKernel\Kernel;
|
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
|
|
|
class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
public function testCollect()
|
|
|
|
{
|
|
|
|
$kernel = new KernelForTest('test',true);
|
|
|
|
$c = new ConfigDataCollector($kernel);
|
|
|
|
$c->collect(new Request(), new Response());
|
2011-03-15 12:43:45 +00:00
|
|
|
|
2011-03-05 23:15:01 +00:00
|
|
|
$this->assertSame('test',$c->getEnv());
|
|
|
|
$this->assertTrue($c->isDebug());
|
|
|
|
$this->assertSame('config',$c->getName());
|
|
|
|
$this->assertSame('testkernel',$c->getAppName());
|
|
|
|
$this->assertSame(PHP_VERSION,$c->getPhpVersion());
|
|
|
|
$this->assertSame(Kernel::VERSION,$c->getSymfonyVersion());
|
|
|
|
$this->assertNull($c->getToken());
|
2011-03-15 12:43:45 +00:00
|
|
|
|
2011-06-12 21:52:53 +01:00
|
|
|
// if else clause because we don't know it
|
2011-03-15 12:43:45 +00:00
|
|
|
if (extension_loaded('xdebug')) {
|
2011-03-05 23:15:01 +00:00
|
|
|
$this->assertTrue($c->hasXdebug());
|
2011-03-15 12:43:45 +00:00
|
|
|
} else {
|
2011-03-05 23:15:01 +00:00
|
|
|
$this->assertFalse($c->hasXdebug());
|
2011-03-15 12:43:45 +00:00
|
|
|
}
|
2011-03-05 23:15:01 +00:00
|
|
|
|
2011-06-12 21:52:53 +01:00
|
|
|
// if else clause because we don't know it
|
2011-03-15 12:43:45 +00:00
|
|
|
if (((extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
|
2011-03-05 23:15:01 +00:00
|
|
|
||
|
|
|
|
(extension_loaded('apc') && ini_get('apc.enabled'))
|
|
|
|
||
|
2011-03-15 12:43:45 +00:00
|
|
|
(extension_loaded('xcache') && ini_get('xcache.cacher')))) {
|
|
|
|
$this->assertTrue($c->hasAccelerator());
|
|
|
|
} else {
|
|
|
|
$this->assertFalse($c->hasAccelerator());
|
2011-03-05 23:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class KernelForTest extends Kernel
|
|
|
|
{
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'testkernel';
|
|
|
|
}
|
2011-03-15 12:43:45 +00:00
|
|
|
|
|
|
|
public function registerBundles()
|
|
|
|
{
|
2011-03-05 23:15:01 +00:00
|
|
|
}
|
2011-03-15 12:43:45 +00:00
|
|
|
|
2011-06-20 07:06:32 +01:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-03-15 12:43:45 +00:00
|
|
|
public function getBundles()
|
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
|
|
{
|
2011-03-05 23:15:01 +00:00
|
|
|
}
|
2011-03-15 12:43:45 +00:00
|
|
|
}
|