Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfadafdc

Browse files
committed
add testcase
1 parent2eaa19f commitfadafdc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespaceSymfony\Component\HttpKernel\CacheWarmer;
1313

14+
useSymfony\Component\HttpKernel\Tests\CacheWarmer\CacheWarmerAggregateTest;
15+
1416
/**
1517
* Aggregates several cache warmers into a single one.
1618
*
@@ -50,7 +52,7 @@ public function enableOnlyOptionalWarmers()
5052
*/
5153
publicfunctionwarmUp($cacheDir)
5254
{
53-
if ($collectDeprecations =$this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
55+
if ($collectDeprecations =$this->debug &&(!\defined('PHPUNIT_COMPOSER_INSTALL') ||file_exists(CacheWarmerAggregateTest::$emptyFile))) {
5456
$collectedLogs = [];
5557
$previousHandler =set_error_handler(function ($type,$message,$file,$line)use (&$collectedLogs, &$previousHandler) {
5658
if (\E_USER_DEPRECATED !==$type && \E_DEPRECATED !==$type) {

‎src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
class CacheWarmerAggregateTestextends TestCase
1919
{
20+
publicstatic$emptyFile;
2021
protectedstatic$cacheDir;
2122

2223
publicstaticfunctionsetUpBeforeClass():void
2324
{
2425
self::$cacheDir =tempnam(sys_get_temp_dir(),'sf_cache_warmer_dir');
26+
self::$emptyFile =tempnam(sys_get_temp_dir(),'empty_file');
2527
}
2628

2729
publicstaticfunctiontearDownAfterClass():void
@@ -68,4 +70,12 @@ public function testWarmupDoesNotCallWarmupOnOptionalWarmersWhenEnableOptionalWa
6870
$aggregate =newCacheWarmerAggregate([$warmer]);
6971
$aggregate->warmUp(self::$cacheDir);
7072
}
73+
74+
publicfunctiontestWarmupEmptyFile()
75+
{
76+
file_put_contents(self::$emptyFile,null);
77+
self::assertFalse(unserialize(file_get_contents(self::$emptyFile)));
78+
$aggregate =newCacheWarmerAggregate([],true,self::$emptyFile);
79+
$aggregate->warmUp(self::$cacheDir);
80+
}
7181
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp