@@ -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 ->assertSame ($ this ->determineSymfonyState (), $ c ->getSymfonyState ());
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
/**
@@ -73,11 +80,37 @@ public function testCollectWithoutKernel()
73
80
$ this ->assertSame (class_exists (\Locale::class, false ) && \Locale::getDefault () ? \Locale::getDefault () : 'n/a ' , $ c ->getPhpIntlLocale ());
8000
74
81
$ this ->assertSame (date_default_timezone_get (), $ c ->getPhpTimezone ());
75
82
$ this ->assertSame (Kernel::VERSION , $ c ->getSymfonyVersion ());
76
- $ this ->assertNull ( $ c ->isSymfonyLts ());
83
+ $ this ->assertSame ( 4 === Kernel:: MINOR_VERSION , $ c ->isSymfonyLts ());
77
84
$ this ->assertNull ($ c ->getToken ());
78
85
$ this ->assertSame (\extension_loaded ('xdebug ' ), $ c ->hasXDebug ());
79
86
$ this ->assertSame (\extension_loaded ('Zend OPcache ' ) && filter_var (ini_get ('opcache.enable ' ), \FILTER_VALIDATE_BOOLEAN ), $ c ->hasZendOpcache ());
80
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 ->assertSame ($ this ->determineSymfonyState (), $ c ->getSymfonyState ());
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
+ }
96
+
97
+ private function determineSymfonyState (): string
98
+ {
99
+ $ now = new \DateTime ();
100
+ $ eom = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_MAINTENANCE )->modify ('last day of this month ' );
101
+ $ eol = \DateTime::createFromFormat ('d/m/Y ' , '01/ ' .Kernel::END_OF_LIFE )->modify ('last day of this month ' );
102
+
103
+ if ($ now > $ eol ) {
104
+ $ versionState = 'eol ' ;
105
+ } elseif ($ now > $ eom ) {
106
+ $ versionState = 'eom ' ;
107
+ } elseif ('' !== Kernel::EXTRA_VERSION ) {
108
+ $ versionState = 'dev ' ;
109
+ } else {
110
+ $ versionState = 'stable ' ;
111
+ }
112
+
113
+ return $ versionState ;
81
114
}
82
115
}
83
116
0 commit comments