Merge remote-tracking branch 'origin/3.4' into 4.4

* origin/3.4:
  add mising sr (latn & cyrl) translations
  allow consumers to mock all methods
This commit is contained in:
Nicolas Grekas 2020-09-11 13:33:24 +02:00
commit 77530a9b75
3 changed files with 95 additions and 1 deletions

View File

@ -366,6 +366,26 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ова вредност треба да буде између {{ min }} и {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Ова вредност није исправно име послужитеља (hostname).</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Број елемената у овој колекцији би требало да буде дељив са {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ова вредност би требало да задовољава најмање једно од наредних ограничења:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Сваки елемент ове колекције би требало да задовољи сопствени скуп ограничења.</target>
</trans-unit>
<trans-unit id="99">
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
<target>Ова вредност није исправна међународна идентификациона ознака хартија од вредности (ISIN).</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -366,6 +366,26 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ova vrednost treba da bude između {{ min }} i {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Ova vrednost nije ispravno ime poslužitelja (hostname).</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Broj elemenata u ovoj kolekciji bi trebalo da bude deljiv sa {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ova vrednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Svaki element ove kolekcije bi trebalo da zadovolji sopstveni skup ograničenja.</target>
</trans-unit>
<trans-unit id="99">
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
<target>Ova vrednost nije ispravna međunarodna identifikaciona oznaka hartija od vrednosti (ISIN).</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -114,10 +114,44 @@ abstract class ConstraintValidatorTestCase extends TestCase
$context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
$context->setConstraint($this->constraint);
$contextualValidator = $this->getMockBuilder(AssertingContextualValidator::class)
->setMethods([
'atPath',
'validate',
'validateProperty',
'validatePropertyValue',
'getViolations',
])
->getMock();
$contextualValidator->expects($this->any())
->method('atPath')
->willReturnCallback(function ($path) use ($contextualValidator) {
return $contextualValidator->doAtPath($path);
});
$contextualValidator->expects($this->any())
->method('validate')
->willReturnCallback(function ($value, $constraints = null, $groups = null) use ($contextualValidator) {
return $contextualValidator->doValidate($value, $constraints, $groups);
});
$contextualValidator->expects($this->any())
->method('validateProperty')
->willReturnCallback(function ($object, $propertyName, $groups = null) use ($contextualValidator) {
return $contextualValidator->validateProperty($object, $propertyName, $groups);
});
$contextualValidator->expects($this->any())
->method('validatePropertyValue')
->willReturnCallback(function ($objectOrClass, $propertyName, $value, $groups = null) use ($contextualValidator) {
return $contextualValidator->doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups);
});
$contextualValidator->expects($this->any())
->method('getViolations')
->willReturnCallback(function () use ($contextualValidator) {
return $contextualValidator->doGetViolations();
});
$validator->expects($this->any())
->method('inContext')
->with($context)
->willReturn($this->getMockBuilder(AssertingContextualValidator::class)->setMethods(null)->getMock());
->willReturn($contextualValidator);
return $context;
}
@ -355,6 +389,10 @@ class AssertingContextualValidator implements ContextualValidatorInterface
private $expectedValidate = [];
public function atPath($path)
{
}
public function doAtPath($path)
{
Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');
@ -368,6 +406,10 @@ class AssertingContextualValidator implements ContextualValidatorInterface
}
public function validate($value, $constraints = null, $groups = null)
{
}
public function doValidate($value, $constraints = null, $groups = null)
{
Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');
@ -381,11 +423,19 @@ class AssertingContextualValidator implements ContextualValidatorInterface
}
public function validateProperty($object, $propertyName, $groups = null)
{
}
public function doValidateProperty($object, $propertyName, $groups = null)
{
return $this;
}
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null)
{
}
public function doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups = null)
{
return $this;
}
@ -394,6 +444,10 @@ class AssertingContextualValidator implements ContextualValidatorInterface
{
}
public function doGetViolations()
{
}
public function expectNoValidate()
{
$this->expectNoValidate = true;