Skip to content

Commit c1b8837

Browse files
Merge branch '6.4' into 7.1
* 6.4: Replace external FTP server by a local docker instance [PhpUnitBridge][Console][VarDumper] Fix handling NO_COLOR env var fix test [Validator] Add test for `D` regex modifier in `TimeValidator`
2 parents 728cec9 + 6733efd commit c1b8837

File tree

7 files changed

+51
-11
lines changed

7 files changed

+51
-11
lines changed

.github/workflows/integration-tests.yml

+13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ jobs:
4444
LDAP_PORT_NUMBER: 3389
4545
LDAP_USERS: a
4646
LDAP_PASSWORDS: a
47+
ftp:
48+
image: onekilo79/ftpd_test
49+
ports:
50+
- 21:21
51+
- 30000-30009:30000-30009
52+
volumes:
53+
- ./:/hostmount
4754
redis:
4855
image: redis:6.2.8
4956
ports:
@@ -162,6 +169,11 @@ jobs:
162169
curl -s -u Administrator:111111@ -X POST http://localhost:8091/pools/default/buckets -d 'ramQuotaMB=100&bucketType=ephemeral&name=cache'
163170
curl -s -u Administrator:111111@ -X POST http://localhost:8091/pools/default -d 'memoryQuota=256'
164171
172+
- name: Create FTP fixtures
173+
run: |
174+
mkdir -p ./ftpusers/test/pub
175+
touch ./ftpusers/test/pub/example ./ftpusers/test/readme.txt
176+
165177
- name: Setup PHP
166178
uses: shivammathur/setup-php@v2
167179
with:
@@ -212,6 +224,7 @@ jobs:
212224
- name: Run tests
213225
run: ./phpunit --group integration -v
214226
env:
227+
INTEGRATION_FTP_URL: 'ftp://test:test@localhost'
215228
REDIS_HOST: 'localhost:16379'
216229
REDIS_AUTHENTICATED_HOST: 'localhost:16380'
217230
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ private static function hasColorSupport(): bool
407407
}
408408

409409
// Follow https://no-color.org/
410-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
410+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
411411
return false;
412412
}
413413

src/Symfony/Component/Console/Output/StreamOutput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function doWrite(string $message, bool $newline): void
9090
protected function hasColorSupport(): bool
9191
{
9292
// Follow https://no-color.org/
93-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
93+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
9494
return false;
9595
}
9696

src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php

+17-5
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,38 @@ protected function setUp(): void
2424

2525
/**
2626
* @group network
27+
* @group integration
2728
*/
2829
public function testRewindOnFtp()
2930
{
30-
$i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
31+
if (!getenv('INTEGRATION_FTP_URL')) {
32+
self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.');
33+
}
34+
35+
$i = new RecursiveDirectoryIterator(getenv('INTEGRATION_FTP_URL').\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS);
3136

3237
$i->rewind();
3338

34-
$this->assertTrue(true);
39+
$this->expectNotToPerformAssertions();
3540
}
3641

3742
/**
3843
* @group network
44+
* @group integration
3945
*/
4046
public function testSeekOnFtp()
4147
{
42-
$i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS);
48+
if (!getenv('INTEGRATION_FTP_URL')) {
49+
self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.');
50+
}
51+
52+
$ftpUrl = getenv('INTEGRATION_FTP_URL');
53+
54+
$i = new RecursiveDirectoryIterator($ftpUrl.\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS);
4355

4456
$contains = [
45-
'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'pub',
46-
'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'readme.txt',
57+
$ftpUrl.\DIRECTORY_SEPARATOR.'pub',
58+
$ftpUrl.\DIRECTORY_SEPARATOR.'readme.txt',
4759
];
4860
$actual = [];
4961

src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ public function testBoundaryContentTypeHeader()
244244
);
245245
}
246246

247-
public function testConstructThrowsOnUnexpectedFieldType()
247+
public function testGetPartsThrowsOnUnexpectedFieldType()
248248
{
249+
$dataPart = new FormDataPart(['foo' => new \stdClass()]);
250+
249251
$this->expectException(InvalidArgumentException::class);
250-
$this->expectExceptionMessage('A form field value can only be a string, an array, or an instance of TextPart ("stdClass" given).');
252+
$this->expectExceptionMessage('The value of the form field "foo" can only be a string, an array, or an instance of TextPart, "stdClass" given.');
251253

252-
new FormDataPart(['foo' => new \stdClass()]);
254+
$dataPart->getParts();
253255
}
254256
}

src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php

+13
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ public function testValidTimesWithoutSeconds(string $time)
9494
$this->assertNoViolation();
9595
}
9696

97+
/**
98+
* @dataProvider getValidTimesWithoutSeconds
99+
*/
100+
public function testValidTimesWithoutSecondsWithNewLine(string $time)
101+
{
102+
$this->validator->validate($time."\n", new Time(withSeconds: false));
103+
104+
$this->buildViolation('This value is not a valid time.')
105+
->setParameter('{{ value }}', '"'.$time."\n".'"')
106+
->setCode(Time::INVALID_FORMAT_ERROR)
107+
->assertRaised();
108+
}
109+
97110
public static function getValidTimesWithoutSeconds()
98111
{
99112
return [

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ private function hasColorSupport(mixed $stream): bool
587587
}
588588

589589
// Follow https://no-color.org/
590-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
590+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
591591
return false;
592592
}
593593

0 commit comments

Comments
 (0)