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

Commiteacb74c

Browse files
alamiraultnicolas-grekas
authored andcommitted
[Config] Allow custom meta location inConfigCache
1 parent87186b2 commiteacb74c

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

‎src/Symfony/Component/Config/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Allow custom meta location in`ResourceCheckerConfigCache`
8+
* Allow custom meta location in`ConfigCache`
89

910
7.0
1011
---

‎src/Symfony/Component/Config/ConfigCache.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@
2626
class ConfigCacheextends ResourceCheckerConfigCache
2727
{
2828
/**
29-
* @param string $file The absolute cache path
30-
* @param bool $debug Whether debugging is enabled or not
29+
* @param string $file The absolute cache path
30+
* @param bool $debug Whether debugging is enabled or not
31+
* @param string|null $metaFile The absolute path to the meta file
3132
*/
3233
publicfunction__construct(
3334
string$file,
3435
privatebool$debug,
36+
?string$metaFile =null,
3537
) {
3638
$checkers = [];
3739
if (true ===$this->debug) {
3840
$checkers = [newSelfCheckingResourceChecker()];
3941
}
4042

41-
parent::__construct($file,$checkers);
43+
parent::__construct($file,$checkers,$metaFile);
4244
}
4345

4446
/**

‎src/Symfony/Component/Config/Tests/ConfigCacheTest.php‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,24 @@
1313

1414
usePHPUnit\Framework\TestCase;
1515
useSymfony\Component\Config\ConfigCache;
16+
useSymfony\Component\Config\Resource\FileResource;
1617
useSymfony\Component\Config\Resource\SelfCheckingResourceChecker;
1718
useSymfony\Component\Config\Tests\Resource\ResourceStub;
1819

1920
class ConfigCacheTestextends TestCase
2021
{
2122
privatestring$cacheFile;
23+
privatestring$metaFile;
2224

2325
protectedfunctionsetUp():void
2426
{
2527
$this->cacheFile =tempnam(sys_get_temp_dir(),'config_');
28+
$this->metaFile =tempnam(sys_get_temp_dir(),'config_');
2629
}
2730

2831
protectedfunctiontearDown():void
2932
{
30-
$files = [$this->cacheFile,$this->cacheFile.'.meta'];
33+
$files = [$this->cacheFile,$this->cacheFile.'.meta',$this->metaFile];
3134

3235
foreach ($filesas$file) {
3336
if (file_exists($file)) {
@@ -103,4 +106,14 @@ public static function debugModes(): array
103106
[false],
104107
];
105108
}
109+
110+
publicfunctiontestCacheWithCustomMetaFile()
111+
{
112+
$this->assertStringEqualsFile($this->metaFile,'');
113+
114+
$cache =newConfigCache($this->cacheFile,false,$this->metaFile);
115+
$cache->write('foo', [newFileResource(__FILE__)]);
116+
117+
$this->assertStringNotEqualsFile($this->metaFile,'');
118+
}
106119
}

‎src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
class ResourceCheckerConfigCacheTestextends TestCase
2121
{
2222
privatestring$cacheFile;
23-
2423
privatestring$metaFile;
2524

2625
protectedfunctionsetUp():void

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp