Skip to content

Commit 20c450f

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: (22 commits) Fix Warning: curl_multi_select(): timeout must be positive [PropertyInfo] Fix ReflectionExtractor handling of underscore-only property names ObjectNormalizer: allow null and scalar [Security] Fix `HttpUtils::createRequest()` when the context’s base URL isn’t empty [Serializer] fix Inherited properties normalization [OptionsResolver] Fix missing prototype key in nested error paths Bump Symfony version to 7.3.8 Update VERSION for 7.3.7 Update CHANGELOG for 7.3.7 Bump Symfony version to 6.4.30 Update VERSION for 6.4.29 Update CHANGELOG for 6.4.29 [FrameworkBundle] Update deprecation message for collect_serializer_data run test using a read-only directory on Windows too [Yaml] Fix parsing of unquoted multiline scalars with comments or blank lines [Clock] Align MockClock::sleep() behavior with NativeClock for negative values [OptionsResolver] Ensure remove() also unsets deprecation status Remove review state for Belarusian translations (entries 141 and 142) [ExpressionLanguage] Compile numbers with var_export in Compiler::repr for thread-safety compatibility with ext-redis 6.3 ...
2 parents 809fd80 + aac4603 commit 20c450f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Tests/DependencyInjection/Compiler/PhpConfigReferenceDumpPassTest.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,31 @@
2626

2727
class PhpConfigReferenceDumpPassTest extends TestCase
2828
{
29+
private string $readOnlyDir;
2930
private string $tempDir;
3031

3132
protected function setUp(): void
3233
{
3334
$this->tempDir = sys_get_temp_dir().'/sf_test_config_reference';
3435
mkdir($this->tempDir, 0o777, true);
36+
37+
// Create a read-only directory to simulate write errors
38+
$this->readOnlyDir = $this->tempDir.'/readonly';
39+
mkdir($this->readOnlyDir, 0o444, true);
40+
41+
// Make the directory read-only on Windows
42+
if ('\\' === \DIRECTORY_SEPARATOR) {
43+
exec('attrib +r '.escapeshellarg($this->readOnlyDir));
44+
}
3545
}
3646

3747
protected function tearDown(): void
3848
{
3949
if (is_dir($this->tempDir)) {
50+
if ('\\' === \DIRECTORY_SEPARATOR) {
51+
exec('attrib -r '.escapeshellarg($this->readOnlyDir));
52+
}
53+
4054
$fs = new Filesystem();
4155
$fs->remove($this->tempDir);
4256
}
@@ -64,23 +78,15 @@ public function testProcessWithConfigDir()
6478

6579
public function testProcessIgnoresFileWriteErrors()
6680
{
67-
if ('\\' === \DIRECTORY_SEPARATOR) {
68-
self::markTestSkipped('Cannot reliably make directory read-only on Windows.');
69-
}
70-
71-
// Create a read-only directory to simulate write errors
72-
$readOnlyDir = $this->tempDir.'/readonly';
73-
mkdir($readOnlyDir, 0o444, true);
74-
7581
$container = new ContainerBuilder();
7682
$container->setParameter('.container.known_envs', ['dev', 'prod', 'test']);
7783

78-
$pass = new PhpConfigReferenceDumpPass($readOnlyDir.'/reference.php', [
84+
$pass = new PhpConfigReferenceDumpPass($this->readOnlyDir.'/reference.php', [
7985
TestBundle::class => ['all' => true],
8086
]);
8187

8288
$pass->process($container);
83-
$this->assertFileDoesNotExist($readOnlyDir.'/reference.php');
89+
$this->assertFileDoesNotExist($this->readOnlyDir.'/reference.php');
8490
$this->assertEmpty($container->getResources());
8591
}
8692

0 commit comments

Comments
 (0)