Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / http-kernel / Tests / DataCollector / ConfigDataCollectorTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests\DataCollector;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector;
16 use Symfony\Component\HttpKernel\Kernel;
17 use Symfony\Component\Config\Loader\LoaderInterface;
18 use Symfony\Component\HttpFoundation\Request;
19 use Symfony\Component\HttpFoundation\Response;
20
21 class ConfigDataCollectorTest extends TestCase
22 {
23     public function testCollect()
24     {
25         $kernel = new KernelForTest('test', true);
26         $c = new ConfigDataCollector();
27         $c->setKernel($kernel);
28         $c->collect(new Request(), new Response());
29
30         $this->assertSame('test', $c->getEnv());
31         $this->assertTrue($c->isDebug());
32         $this->assertSame('config', $c->getName());
33         $this->assertSame('testkernel', $c->getAppName());
34         $this->assertSame(PHP_VERSION, $c->getPhpVersion());
35         $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
36         $this->assertNull($c->getToken());
37
38         // if else clause because we don't know it
39         if (extension_loaded('xdebug')) {
40             $this->assertTrue($c->hasXDebug());
41         } else {
42             $this->assertFalse($c->hasXDebug());
43         }
44
45         // if else clause because we don't know it
46         if (((extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
47                 ||
48                 (extension_loaded('apc') && ini_get('apc.enabled'))
49                 ||
50                 (extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
51                 ||
52                 (extension_loaded('xcache') && ini_get('xcache.cacher'))
53                 ||
54                 (extension_loaded('wincache') && ini_get('wincache.ocenabled')))) {
55             $this->assertTrue($c->hasAccelerator());
56         } else {
57             $this->assertFalse($c->hasAccelerator());
58         }
59     }
60 }
61
62 class KernelForTest extends Kernel
63 {
64     public function getName()
65     {
66         return 'testkernel';
67     }
68
69     public function registerBundles()
70     {
71     }
72
73     public function getBundles()
74     {
75         return array();
76     }
77
78     public function registerContainerConfiguration(LoaderInterface $loader)
79     {
80     }
81 }