8000 Checking SymfonyState against prefedined array · symfony/symfony@5192ca0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5192ca0

Browse files
committed
Checking SymfonyState against prefedined array
1 parent a202182 commit 5192ca0

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testCollect()
4242
$this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache());
4343
$this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN), $c->hasApcu());
4444
$this->assertSame(sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION), $c->getSymfonyMinorVersion());
45-
$this->assertSame($this->determineSymfonyState(), $c->getSymfonyState());
45+
$this->assertContains($c->getSymfonyState(), ['eol', 'eom', 'dev', 'stable']);
4646

4747
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE)->format('F Y');
4848
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE)->format('F Y');
@@ -86,32 +86,13 @@ public function testCollectWithoutKernel()
8686
$this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache());
8787
$this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN), $c->hasApcu());
8888
$this->assertSame(sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION), $c->getSymfonyMinorVersion());
89-
$this->assertSame($this->determineSymfonyState(), $c->getSymfonyState());
89+
$this->assertContains($c->getSymfonyState(), ['eol', 'eom', 'dev', 'stable']);
9090

9191
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE)->format('F Y');
9292
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE)->format('F Y');
9393
$this->assertSame($eom, $c->getSymfonyEom());
9494
$this->assertSame($eol, $c->getSymfonyEol());
9595
}
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;
114-
}
11596
}
11697

11798
class KernelForTest extends Kernel

0 commit comments

Comments
 (0)
0