Skip to content

Commit 835f148

Browse files
Merge branch '3.4' into 4.2
* 3.4: cs fix cs fix [PHPUnit-Bridge] override some environment variables [TwigBridge] Remove use spaceless tag [translation] Update defaut format from yml to yaml Change default log level for output streams update docblock to match the actual behavior compatibility with phpunit8 [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods Added translations for chineese language.
2 parents 228689f + 5bac03e commit 835f148

File tree

3 files changed

+106
-2
lines changed

3 files changed

+106
-2
lines changed

Resources/translations/validators.zh_CN.xlf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,30 @@
310310
<source>This value does not match the expected {{ charset }} charset.</source>
311311
<target>该值不符合 {{ charset }} 编码。</target>
312312
</trans-unit>
313+
<trans-unit id="81">
314+
<source>This is not a valid Business Identifier Code (BIC).</source>
315+
<target>这不是有效的业务标识符代码(BIC)。</target>
316+
</trans-unit>
313317
<trans-unit id="82">
314318
<source>Error</source>
315319
<target>错误</target>
316320
</trans-unit>
321+
<trans-unit id="83">
322+
<source>This is not a valid UUID.</source>
323+
<target>这不是有效的UUID。</target>
324+
</trans-unit>
325+
<trans-unit id="84">
326+
<source>This value should be a multiple of {{ compared_value }}.</source>
327+
<target>此值应为 {{ compared_value }} 的倍数。</target>
328+
</trans-unit>
329+
<trans-unit id="85">
330+
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
331+
<target>此业务标识符代码(BIC)与IBAN {{ iban }} 无关。</target>
332+
</trans-unit>
333+
<trans-unit id="86">
334+
<source>This value should be valid JSON.</source>
335+
<target>该值应该是有效的JSON。</target>
336+
</trans-unit>
317337
</body>
318338
</file>
319339
</xliff>

Test/ConstraintValidatorTestCase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
*/
3131
abstract class ConstraintValidatorTestCase extends TestCase
3232
{
33+
use TestCaseSetUpTearDownTrait;
34+
3335
/**
3436
* @var ExecutionContextInterface
3537
*/
@@ -49,7 +51,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
4951
protected $constraint;
5052
protected $defaultTimezone;
5153

52-
protected function setUp()
54+
private function doSetUp()
5355
{
5456
$this->group = 'MyGroup';
5557
$this->metadata = null;
@@ -71,7 +73,7 @@ protected function setUp()
7173
$this->setDefaultTimezone('UTC');
7274
}
7375

74-
protected function tearDown()
76+
private function doTearDown()
7577
{
7678
$this->restoreDefaultTimezone();
7779
}

Test/TestCaseSetUpTearDownTrait.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Test;
13+
14+
use PHPUnit\Framework\TestCase;
15+
16+
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
17+
18+
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
19+
eval('
20+
namespace Symfony\Component\Validator\Test;
21+
22+
/**
23+
* @internal
24+
*/
25+
trait TestCaseSetUpTearDownTrait
26+
{
27+
private function doSetUp(): void
28+
{
29+
}
30+
31+
private function doTearDown(): void
32+
{
33+
}
34+
35+
protected function setUp(): void
36+
{
37+
$this->doSetUp();
38+
}
39+
40+
protected function tearDown(): void
41+
{
42+
$this->doTearDown();
43+
}
44+
}
45+
');
46+
} else {
47+
/**
48+
* @internal
49+
*/
50+
trait TestCaseSetUpTearDownTrait
51+
{
52+
/**
53+
* @return void
54+
*/
55+
private function doSetUp()
56+
{
57+
}
58+
59+
/**
60+
* @return void
61+
*/
62+
private function doTearDown()
63+
{
64+
}
65+
66+
/**
67+
* @return void
68+
*/
69+
protected function setUp()
70+
{
71+
$this->doSetUp();
72+
}
73+
74+
/**
75+
* @return void
76+
*/
77+
protected function tearDown()
78+
{
79+
$this->doTearDown();
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)