@@ -41,6 +41,13 @@ public function testCollect()
41
41
$ this ->assertSame (\extension_loaded ('xdebug ' ), $ c ->hasXDebug ());
42
42
$ this ->assertSame (\extension_loaded ('Zend OPcache ' ) && filter_var (ini_get ('opcache.enable ' ), \FILTER_VALIDATE_BOOLEAN ), $ c ->hasZendOpcache ());
43
43
$ this ->assertSame (\extension_loaded ('apcu ' ) && filter_var (ini_get ('apc.enabled ' ), \FILTER_VALIDATE_BOOLEAN ), $ c ->hasApcu ());
44
+ $ this ->assertSame (sprintf ('%s.%s ' , Kernel::MAJOR_VERSION , Kernel::MINOR_VERSION ), $ c ->getSymfonyMinorVersion ());
45
+ $ this ->assertContains ($ c ->getSymfonyState (), ['eol ' , 'eom ' , 'dev ' , 'stable ' ]);
46
+
47
+ $ eom = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_MAINTENANCE )->format ('F Y ' );
48
+ $ eol = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_LIFE )->format ('F Y ' );
49
+ $ this ->assertSame ($ eom , $ c ->getSymfonyEom ());
50
+ $ this ->assertSame ($ eol , $ c ->getSymfonyEol ());
44
51
}
45
52
46
53
/**
@@ -58,6 +65,34 @@ public function testLegacy()
58
65
$ this ->assertSame ('name ' , $ c ->getApplicationName ());
59
66
$ this ->assertNull ($ c ->getApplicationVersion ());
60
67
}
68
+
69
+ public function testCollectWithoutKernel ()
70
+ {
71
+ $ c = new ConfigDataCollector ();
72
+ $ c ->collect (new Request (), new Response ());
73
+
74
+ $ this ->assertSame ('n/a ' , $ c ->getEnv ());
75
+ $ this ->assertSame ('n/a ' , $ c ->isDebug ());
76
+ $ this ->assertSame ('config ' , $ c ->getName ());
77
+ $ this ->assertMatchesRegularExpression ('~^ ' .preg_quote ($ c ->getPhpVersion (), '~ ' ).'~ ' , \PHP_VERSION );
78
+ $ this ->assertMatchesRegularExpression ('~ ' .preg_quote ((string ) $ c ->getPhpVersionExtra (), '~ ' ).'$~ ' , \PHP_VERSION );
79
+ $ this ->assertSame (\PHP_INT_SIZE * 8 , $ c ->getPhpArchitecture ());
80
+ $ this ->assertSame (class_exists (\Locale::class, false ) && \Locale::getDefault () ? \Locale::getDefault () : 'n/a ' , $ c ->getPhpIntlLocale ());
81
+ $ this ->assertSame (date_default_timezone_get (), $ c ->getPhpTimezone ());
82
+ $ this ->assertSame (Kernel::VERSION , $ c ->getSymfonyVersion ());
83
+ $ this ->assertSame (4 === Kernel::MINOR_VERSION , $ c ->isSymfonyLts ());
84
+ $ this ->assertNull ($ c ->getToken ());
85
+ $ this ->assertSame (\extension_loaded ('xdebug ' ), $ c ->hasXDebug ());
86
+ $ this ->assertSame (\extension_loaded ('Zend OPcache ' ) && filter_var (ini_get ('opcache.enable ' ), \FILTER_VALIDATE_BOOLEAN ), $ c ->hasZendOpcache ());
87
+ $ this ->assertSame (\extension_loaded ('apcu ' ) && filter_var (ini_get ('apc.enabled ' ), \FILTER_VALIDATE_BOOLEAN ), $ c ->hasApcu ());
88
+ $ this ->assertSame (sprintf ('%s.%s ' , Kernel::MAJOR_VERSION , Kernel::MINOR_VERSION ), $ c ->getSymfonyMinorVersion ());
89
+ $ this ->assertContains ($ c ->getSymfonyState (), ['eol ' , 'eom ' , 'dev ' , 'stable ' ]);
90
+
91
+ $ eom = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_MAINTENANCE )->format ('F Y ' );
92
+ $ eol = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_LIFE )->format ('F Y ' );
93
+ $ this ->assertSame ($ eom , $ c ->getSymfonyEom ());
94
+ $ this ->assertSame ($ eol , $ c ->getSymfonyEol ());
95
+ }
61
96
}
62
97
63
98
class KernelForTest extends Kernel
0 commit comments