[Validator] removed usage of deprecated getMessageParameters() and getMessagePluralization() in unit tests

This commit is contained in:
Fabien Potencier 2015-01-09 09:17:37 +01:00
parent c6f1f69b7a
commit 818ca589d8
3 changed files with 52 additions and 52 deletions

View File

@ -155,12 +155,12 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
$test->assertCount(1, $violations);
$test->assertSame('Message value', $violations[0]->getMessage());
$test->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$test->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$test->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$test->assertSame('', $violations[0]->getPropertyPath());
// The root is different as we're in a new context
$test->assertSame($entity->reference, $violations[0]->getRoot());
$test->assertSame($entity->reference, $violations[0]->getInvalidValue());
$test->assertNull($violations[0]->getMessagePluralization());
$test->assertNull($violations[0]->getPlural());
$test->assertNull($violations[0]->getCode());
// Verify that this method is called
@ -252,11 +252,11 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('subpath', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -316,11 +316,11 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('subpath[key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -355,11 +355,11 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('[key]', $violations[0]->getPropertyPath());
$this->assertSame($traversable, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -527,11 +527,11 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Invalid value', $violations[0]->getInvalidValue());
$this->assertSame(2, $violations[0]->getMessagePluralization());
$this->assertSame(2, $violations[0]->getPlural());
$this->assertSame(42, $violations[0]->getCode());
}

View File

@ -166,11 +166,11 @@ abstract class AbstractLegacyApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('subpath', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -224,11 +224,11 @@ abstract class AbstractLegacyApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('subpath[key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -254,11 +254,11 @@ abstract class AbstractLegacyApiTest extends AbstractValidatorTest
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Invalid value', $violations[0]->getInvalidValue());
$this->assertSame(2, $violations[0]->getMessagePluralization());
$this->assertSame(2, $violations[0]->getPlural());
$this->assertSame('Code', $violations[0]->getCode());
}

View File

@ -96,11 +96,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('', $violations[0]->getPropertyPath());
$this->assertSame('Bernhard', $violations[0]->getRoot());
$this->assertSame('Bernhard', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -133,11 +133,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -173,11 +173,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('firstName', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Bernhard', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -213,11 +213,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('lastName', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Schussek', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -251,11 +251,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('[key]', $violations[0]->getPropertyPath());
$this->assertSame($array, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -289,11 +289,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('[2][key]', $violations[0]->getPropertyPath());
$this->assertSame($array, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -327,11 +327,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('[key]', $violations[0]->getPropertyPath());
$this->assertSame($traversable, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -367,11 +367,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('[2][key]', $violations[0]->getPropertyPath());
$this->assertSame($traversable, $violations[0]->getRoot());
$this->assertSame($entity, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -406,11 +406,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference, $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -448,11 +448,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference.value', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Foobar', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -490,11 +490,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference.privateValue', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Bamboo', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -555,11 +555,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference[key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -595,11 +595,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference[2][key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -700,11 +700,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference[key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -779,11 +779,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('reference[2][key]', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -828,11 +828,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('firstName', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Bernhard', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -909,11 +909,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('firstName', $violations[0]->getPropertyPath());
$this->assertSame($entity, $violations[0]->getRoot());
$this->assertSame('Bernhard', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}
@ -960,11 +960,11 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $violations);
$this->assertSame('Message value', $violations[0]->getMessage());
$this->assertSame('Message %param%', $violations[0]->getMessageTemplate());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters());
$this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters());
$this->assertSame('', $violations[0]->getPropertyPath());
$this->assertSame('Bernhard', $violations[0]->getRoot());
$this->assertSame('Bernhard', $violations[0]->getInvalidValue());
$this->assertNull($violations[0]->getMessagePluralization());
$this->assertNull($violations[0]->getPlural());
$this->assertNull($violations[0]->getCode());
}