class ConstraintValidatorTestCase
A test case to ease testing Constraint Validators.
@author Bernhard Schussek <bschussek@gmail.com>
@template T of ConstraintValidatorInterface
Hierarchy
- class \PHPUnit\Framework\Assert
- class \PHPUnit\Framework\TestCase extends \PHPUnit\Framework\Assert implements \PHPUnit\Framework\Reorderable, \PHPUnit\Framework\SelfDescribing, \PHPUnit\Framework\Test
- class \Symfony\Component\Validator\Test\ConstraintValidatorTestCase extends \PHPUnit\Framework\TestCase
- class \PHPUnit\Framework\TestCase extends \PHPUnit\Framework\Assert implements \PHPUnit\Framework\Reorderable, \PHPUnit\Framework\SelfDescribing, \PHPUnit\Framework\Test
Expanded class hierarchy of ConstraintValidatorTestCase
File
-
vendor/
symfony/ validator/ Test/ ConstraintValidatorTestCase.php, line 46
Namespace
Symfony\Component\Validator\TestView source
abstract class ConstraintValidatorTestCase extends TestCase {
protected ExecutionContextInterface $context;
/**
* @var T
*/
protected ConstraintValidatorInterface $validator;
protected string $group;
protected ?MetadataInterface $metadata;
protected mixed $object;
protected mixed $value;
protected mixed $root;
protected string $propertyPath;
protected Constraint $constraint;
protected ?string $defaultTimezone = null;
private string $defaultLocale;
private array $expectedViolations;
private int $call;
protected function setUp() : void {
$this->group = 'MyGroup';
$this->metadata = null;
$this->object = null;
$this->value = 'InvalidValue';
$this->root = 'root';
$this->propertyPath = 'property.path';
// Initialize the context with some constraint so that we can
// successfully build a violation.
$this->constraint = new NotNull();
$this->context = $this->createContext();
$this->validator = $this->createValidator();
$this->validator
->initialize($this->context);
if (class_exists(\Locale::class)) {
$this->defaultLocale = \Locale::getDefault();
\Locale::setDefault('en');
}
$this->expectedViolations = [];
$this->call = 0;
$this->setDefaultTimezone('UTC');
}
protected function tearDown() : void {
$this->restoreDefaultTimezone();
if (class_exists(\Locale::class)) {
\Locale::setDefault($this->defaultLocale);
}
}
protected function setDefaultTimezone(?string $defaultTimezone) {
// Make sure this method cannot be called twice before calling
// also restoreDefaultTimezone()
if (null === $this->defaultTimezone) {
$this->defaultTimezone = date_default_timezone_get();
date_default_timezone_set($defaultTimezone);
}
}
protected function restoreDefaultTimezone() {
if (null !== $this->defaultTimezone) {
date_default_timezone_set($this->defaultTimezone);
$this->defaultTimezone = null;
}
}
protected function createContext() {
$translator = $this->createMock(TranslatorInterface::class);
$translator->expects($this->any())
->method('trans')
->willReturnArgument(0);
$validator = $this->createMock(ValidatorInterface::class);
$validator->expects($this->any())
->method('validate')
->willReturnCallback(fn() => $this->expectedViolations[$this->call++] ?? new ConstraintViolationList());
$context = new ExecutionContext($validator, $this->root, $translator);
$context->setGroup($this->group);
$context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
$context->setConstraint($this->constraint);
$contextualValidatorMockBuilder = $this->getMockBuilder(AssertingContextualValidator::class)
->setConstructorArgs([
$context,
]);
$contextualValidatorMethods = [
'atPath',
'validate',
'validateProperty',
'validatePropertyValue',
'getViolations',
];
$contextualValidatorMockBuilder->onlyMethods($contextualValidatorMethods);
$contextualValidator = $contextualValidatorMockBuilder->getMock();
$contextualValidator->expects($this->any())
->method('atPath')
->willReturnCallback(fn($path) => $contextualValidator->doAtPath($path));
$contextualValidator->expects($this->any())
->method('validate')
->willReturnCallback(fn($value, $constraints = null, $groups = null) => $contextualValidator->doValidate($value, $constraints, $groups));
$contextualValidator->expects($this->any())
->method('validateProperty')
->willReturnCallback(fn($object, $propertyName, $groups = null) => $contextualValidator->validateProperty($object, $propertyName, $groups));
$contextualValidator->expects($this->any())
->method('validatePropertyValue')
->willReturnCallback(fn($objectOrClass, $propertyName, $value, $groups = null) => $contextualValidator->doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups));
$contextualValidator->expects($this->any())
->method('getViolations')
->willReturnCallback(fn() => $contextualValidator->doGetViolations());
$validator->expects($this->any())
->method('inContext')
->with($context)
->willReturn($contextualValidator);
return $context;
}
protected function setGroup(?string $group) {
$this->group = $group;
$this->context
->setGroup($group);
}
protected function setObject(mixed $object) {
$this->object = $object;
$this->metadata = \is_object($object) ? new ClassMetadata($object::class) : null;
$this->context
->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}
protected function setProperty(mixed $object, string $property) {
$this->object = $object;
$this->metadata = \is_object($object) ? new PropertyMetadata($object::class, $property) : null;
$this->context
->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}
protected function setValue(mixed $value) {
$this->value = $value;
$this->context
->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}
protected function setRoot(mixed $root) {
$this->root = $root;
$this->context = $this->createContext();
$this->validator
->initialize($this->context);
}
protected function setPropertyPath(string $propertyPath) {
$this->propertyPath = $propertyPath;
$this->context
->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}
protected function expectNoValidate() {
$validator = $this->context
->getValidator()
->inContext($this->context);
$validator->expectNoValidate();
}
protected function expectValidateAt(int $i, string $propertyPath, mixed $value, string|GroupSequence|array|null $group) {
$validator = $this->context
->getValidator()
->inContext($this->context);
$validator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) {
$expectedConstraints = LogicalOr::fromConstraints(new IsNull(), new IsIdentical([]), new IsInstanceOf(Valid::class));
Assert::assertThat($passedConstraints, $expectedConstraints);
});
}
protected function expectValidateValue(int $i, mixed $value, array $constraints = [], string|GroupSequence|array|null $group = null) {
$contextualValidator = $this->context
->getValidator()
->inContext($this->context);
$contextualValidator->expectValidation($i, null, $value, $group, function ($passedConstraints) use ($constraints) {
if (!\is_array($passedConstraints)) {
$passedConstraints = [
$passedConstraints,
];
}
Assert::assertEquals($constraints, $passedConstraints);
});
}
protected function expectFailingValueValidation(int $i, mixed $value, array $constraints, string|GroupSequence|array|null $group, ConstraintViolationInterface $violation) {
$contextualValidator = $this->context
->getValidator()
->inContext($this->context);
$contextualValidator->expectValidation($i, null, $value, $group, function ($passedConstraints) use ($constraints) {
if (!\is_array($passedConstraints)) {
$passedConstraints = [
$passedConstraints,
];
}
Assert::assertEquals($constraints, $passedConstraints);
}, $violation);
}
protected function expectValidateValueAt(int $i, string $propertyPath, mixed $value, Constraint|array $constraints, string|GroupSequence|array|null $group = null) {
$contextualValidator = $this->context
->getValidator()
->inContext($this->context);
$contextualValidator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) use ($constraints) {
Assert::assertEquals($constraints, $passedConstraints);
});
}
protected function expectViolationsAt(int $i, mixed $value, Constraint $constraint) {
$context = $this->createContext();
$validatorClassname = $constraint->validatedBy();
$validator = new $validatorClassname();
$validator->initialize($context);
$validator->validate($value, $constraint);
$this->expectedViolations[] = $context->getViolations();
return $context->getViolations();
}
protected function assertNoViolation() {
$this->assertSame(0, $violationsCount = \count($this->context
->getViolations()), \sprintf('0 violation expected. Got %u.', $violationsCount));
}
protected function buildViolation(string|\Stringable $message) : ConstraintViolationAssertion {
return new ConstraintViolationAssertion($this->context, $message, $this->constraint);
}
/**
* @return T
*/
protected abstract function createValidator() : ConstraintValidatorInterface;
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|---|
Assert::$count | private static | property | |||
Assert::anything | final public static | function | |||
Assert::arrayHasKey | final public static | function | |||
Assert::assertArrayHasKey | final public static | function | Asserts that an array has a specified key. | ||
Assert::assertArrayNotHasKey | final public static | function | Asserts that an array does not have a specified key. | ||
Assert::assertContains | final public static | function | Asserts that a haystack contains a needle. | ||
Assert::assertContainsEquals | final public static | function | |||
Assert::assertContainsOnly | final public static | function | Asserts that a haystack contains only values of a given type. | ||
Assert::assertContainsOnlyInstancesOf | final public static | function | Asserts that a haystack contains only instances of a given class name. | ||
Assert::assertCount | final public static | function | Asserts the number of elements of an array, Countable or Traversable. | ||
Assert::assertDirectoryDoesNotExist | final public static | function | Asserts that a directory does not exist. | ||
Assert::assertDirectoryExists | final public static | function | Asserts that a directory exists. | ||
Assert::assertDirectoryIsNotReadable | final public static | function | Asserts that a directory exists and is not readable. | ||
Assert::assertDirectoryIsNotWritable | final public static | function | Asserts that a directory exists and is not writable. | ||
Assert::assertDirectoryIsReadable | final public static | function | Asserts that a directory exists and is readable. | ||
Assert::assertDirectoryIsWritable | final public static | function | Asserts that a directory exists and is writable. | ||
Assert::assertDoesNotMatchRegularExpression | final public static | function | Asserts that a string does not match a given regular expression. | ||
Assert::assertEmpty | final public static | function | Asserts that a variable is empty. | ||
Assert::assertEquals | final public static | function | Asserts that two variables are equal. | ||
Assert::assertEqualsCanonicalizing | final public static | function | Asserts that two variables are equal (canonicalizing). | ||
Assert::assertEqualsIgnoringCase | final public static | function | Asserts that two variables are equal (ignoring case). | ||
Assert::assertEqualsWithDelta | final public static | function | Asserts that two variables are equal (with delta). | ||
Assert::assertFalse | final public static | function | Asserts that a condition is false. | ||
Assert::assertFileDoesNotExist | final public static | function | Asserts that a file does not exist. | ||
Assert::assertFileEquals | final public static | function | Asserts that the contents of one file is equal to the contents of another file. |
||
Assert::assertFileEqualsCanonicalizing | final public static | function | Asserts that the contents of one file is equal to the contents of another file (canonicalizing). |
||
Assert::assertFileEqualsIgnoringCase | final public static | function | Asserts that the contents of one file is equal to the contents of another file (ignoring case). |
||
Assert::assertFileExists | final public static | function | Asserts that a file exists. | ||
Assert::assertFileIsNotReadable | final public static | function | Asserts that a file exists and is not readable. | ||
Assert::assertFileIsNotWritable | final public static | function | Asserts that a file exists and is not writable. | ||
Assert::assertFileIsReadable | final public static | function | Asserts that a file exists and is readable. | ||
Assert::assertFileIsWritable | final public static | function | Asserts that a file exists and is writable. | ||
Assert::assertFileMatchesFormat | final public static | function | Asserts that a string matches a given format string. | ||
Assert::assertFileMatchesFormatFile | final public static | function | Asserts that a string matches a given format string. | ||
Assert::assertFileNotEquals | final public static | function | Asserts that the contents of one file is not equal to the contents of another file. |
||
Assert::assertFileNotEqualsCanonicalizing | final public static | function | Asserts that the contents of one file is not equal to the contents of another file (canonicalizing). |
||
Assert::assertFileNotEqualsIgnoringCase | final public static | function | Asserts that the contents of one file is not equal to the contents of another file (ignoring case). |
||
Assert::assertFinite | final public static | function | Asserts that a variable is finite. | ||
Assert::assertGreaterThan | final public static | function | Asserts that a value is greater than another value. | ||
Assert::assertGreaterThanOrEqual | final public static | function | Asserts that a value is greater than or equal to another value. | ||
Assert::assertInfinite | final public static | function | Asserts that a variable is infinite. | ||
Assert::assertInstanceOf | final public static | function | Asserts that a variable is of a given type. | ||
Assert::assertIsArray | final public static | function | Asserts that a variable is of type array. | ||
Assert::assertIsBool | final public static | function | Asserts that a variable is of type bool. | ||
Assert::assertIsCallable | final public static | function | Asserts that a variable is of type callable. | ||
Assert::assertIsClosedResource | final public static | function | Asserts that a variable is of type resource and is closed. | ||
Assert::assertIsFloat | final public static | function | Asserts that a variable is of type float. | ||
Assert::assertIsInt | final public static | function | Asserts that a variable is of type int. | ||
Assert::assertIsIterable | final public static | function | Asserts that a variable is of type iterable. | ||
Assert::assertIsList | final public static | function | |||
Assert::assertIsNotArray | final public static | function | Asserts that a variable is not of type array. | ||
Assert::assertIsNotBool | final public static | function | Asserts that a variable is not of type bool. | ||
Assert::assertIsNotCallable | final public static | function | Asserts that a variable is not of type callable. | ||
Assert::assertIsNotClosedResource | final public static | function | Asserts that a variable is not of type resource. | ||
Assert::assertIsNotFloat | final public static | function | Asserts that a variable is not of type float. | ||
Assert::assertIsNotInt | final public static | function | Asserts that a variable is not of type int. | ||
Assert::assertIsNotIterable | final public static | function | Asserts that a variable is not of type iterable. | ||
Assert::assertIsNotNumeric | final public static | function | Asserts that a variable is not of type numeric. | ||
Assert::assertIsNotObject | final public static | function | Asserts that a variable is not of type object. | ||
Assert::assertIsNotReadable | final public static | function | Asserts that a file/dir exists and is not readable. | ||
Assert::assertIsNotResource | final public static | function | Asserts that a variable is not of type resource. | ||
Assert::assertIsNotScalar | final public static | function | Asserts that a variable is not of type scalar. | ||
Assert::assertIsNotString | final public static | function | Asserts that a variable is not of type string. | ||
Assert::assertIsNotWritable | final public static | function | Asserts that a file/dir exists and is not writable. | ||
Assert::assertIsNumeric | final public static | function | Asserts that a variable is of type numeric. | ||
Assert::assertIsObject | final public static | function | Asserts that a variable is of type object. | ||
Assert::assertIsReadable | final public static | function | Asserts that a file/dir is readable. | ||
Assert::assertIsResource | final public static | function | Asserts that a variable is of type resource. | ||
Assert::assertIsScalar | final public static | function | Asserts that a variable is of type scalar. | ||
Assert::assertIsString | final public static | function | Asserts that a variable is of type string. | ||
Assert::assertIsWritable | final public static | function | Asserts that a file/dir exists and is writable. | ||
Assert::assertJson | final public static | function | Asserts that a string is a valid JSON string. | ||
Assert::assertJsonFileEqualsJsonFile | final public static | function | Asserts that two JSON files are equal. | ||
Assert::assertJsonFileNotEqualsJsonFile | final public static | function | Asserts that two JSON files are not equal. | ||
Assert::assertJsonStringEqualsJsonFile | final public static | function | Asserts that the generated JSON encoded object and the content of the given file are equal. | ||
Assert::assertJsonStringEqualsJsonString | final public static | function | Asserts that two given JSON encoded objects or arrays are equal. | ||
Assert::assertJsonStringNotEqualsJsonFile | final public static | function | Asserts that the generated JSON encoded object and the content of the given file are not equal. | ||
Assert::assertJsonStringNotEqualsJsonString | final public static | function | Asserts that two given JSON encoded objects or arrays are not equal. | ||
Assert::assertLessThan | final public static | function | Asserts that a value is smaller than another value. | ||
Assert::assertLessThanOrEqual | final public static | function | Asserts that a value is smaller than or equal to another value. | ||
Assert::assertMatchesRegularExpression | final public static | function | Asserts that a string matches a given regular expression. | ||
Assert::assertNan | final public static | function | Asserts that a variable is nan. | ||
Assert::assertNotContains | final public static | function | Asserts that a haystack does not contain a needle. | ||
Assert::assertNotContainsEquals | final public static | function | |||
Assert::assertNotContainsOnly | final public static | function | Asserts that a haystack does not contain only values of a given type. | ||
Assert::assertNotCount | final public static | function | Asserts the number of elements of an array, Countable or Traversable. | ||
Assert::assertNotEmpty | final public static | function | Asserts that a variable is not empty. | ||
Assert::assertNotEquals | final public static | function | Asserts that two variables are not equal. | ||
Assert::assertNotEqualsCanonicalizing | final public static | function | Asserts that two variables are not equal (canonicalizing). | ||
Assert::assertNotEqualsIgnoringCase | final public static | function | Asserts that two variables are not equal (ignoring case). | ||
Assert::assertNotEqualsWithDelta | final public static | function | Asserts that two variables are not equal (with delta). | ||
Assert::assertNotFalse | final public static | function | Asserts that a condition is not false. | ||
Assert::assertNotInstanceOf | final public static | function | Asserts that a variable is not of a given type. | ||
Assert::assertNotNull | final public static | function | Asserts that a variable is not null. | ||
Assert::assertNotSame | final public static | function | Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object. |
||
Assert::assertNotSameSize | final public static | function | Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. |
||
Assert::assertNotTrue | final public static | function | Asserts that a condition is not true. | ||
Assert::assertNull | final public static | function | Asserts that a variable is null. | ||
Assert::assertObjectEquals | final public static | function | |||
Assert::assertObjectHasProperty | final public static | function | Asserts that an object has a specified property. | ||
Assert::assertObjectNotHasProperty | final public static | function | Asserts that an object does not have a specified property. | ||
Assert::assertSame | final public static | function | Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object. |
||
Assert::assertSameSize | final public static | function | Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. |
||
Assert::assertStringContainsString | final public static | function | |||
Assert::assertStringContainsStringIgnoringCase | final public static | function | |||
Assert::assertStringContainsStringIgnoringLineEndings | final public static | function | |||
Assert::assertStringEndsNotWith | final public static | function | Asserts that a string ends not with a given suffix. | ||
Assert::assertStringEndsWith | final public static | function | Asserts that a string ends with a given suffix. | ||
Assert::assertStringEqualsFile | final public static | function | Asserts that the contents of a string is equal to the contents of a file. |
||
Assert::assertStringEqualsFileCanonicalizing | final public static | function | Asserts that the contents of a string is equal to the contents of a file (canonicalizing). |
||
Assert::assertStringEqualsFileIgnoringCase | final public static | function | Asserts that the contents of a string is equal to the contents of a file (ignoring case). |
||
Assert::assertStringEqualsStringIgnoringLineEndings | final public static | function | Asserts that two strings are equal except for line endings. | ||
Assert::assertStringMatchesFormat | final public static | function | Asserts that a string matches a given format string. | ||
Assert::assertStringMatchesFormatFile | final public static | function | Asserts that a string matches a given format file. | ||
Assert::assertStringNotContainsString | final public static | function | |||
Assert::assertStringNotContainsStringIgnoringCase | final public static | function | |||
Assert::assertStringNotEqualsFile | final public static | function | Asserts that the contents of a string is not equal to the contents of a file. |
||
Assert::assertStringNotEqualsFileCanonicalizing | final public static | function | Asserts that the contents of a string is not equal to the contents of a file (canonicalizing). |
||
Assert::assertStringNotEqualsFileIgnoringCase | final public static | function | Asserts that the contents of a string is not equal to the contents of a file (ignoring case). |
||
Assert::assertStringNotMatchesFormat | Deprecated | final public static | function | Asserts that a string does not match a given format string. | |
Assert::assertStringNotMatchesFormatFile | Deprecated | final public static | function | Asserts that a string does not match a given format string. | |
Assert::assertStringStartsNotWith | final public static | function | Asserts that a string starts not with a given prefix. | ||
Assert::assertStringStartsWith | final public static | function | Asserts that a string starts with a given prefix. | ||
Assert::assertThat | final public static | function | Evaluates a PHPUnit\Framework\Constraint matcher object. | ||
Assert::assertTrue | final public static | function | Asserts that a condition is true. | ||
Assert::assertXmlFileEqualsXmlFile | final public static | function | Asserts that two XML files are equal. | ||
Assert::assertXmlFileNotEqualsXmlFile | final public static | function | Asserts that two XML files are not equal. | ||
Assert::assertXmlStringEqualsXmlFile | final public static | function | Asserts that two XML documents are equal. | ||
Assert::assertXmlStringEqualsXmlString | final public static | function | Asserts that two XML documents are equal. | ||
Assert::assertXmlStringNotEqualsXmlFile | final public static | function | Asserts that two XML documents are not equal. | ||
Assert::assertXmlStringNotEqualsXmlString | final public static | function | Asserts that two XML documents are not equal. | ||
Assert::callback | final public static | function | @psalm-template CallbackInput of mixed | ||
Assert::containsEqual | final public static | function | |||
Assert::containsIdentical | final public static | function | |||
Assert::containsOnly | final public static | function | |||
Assert::containsOnlyInstancesOf | final public static | function | |||
Assert::countOf | final public static | function | |||
Assert::directoryExists | final public static | function | |||
Assert::equalTo | final public static | function | |||
Assert::equalToCanonicalizing | final public static | function | |||
Assert::equalToIgnoringCase | final public static | function | |||
Assert::equalToWithDelta | final public static | function | |||
Assert::fail | final public static | function | Fails a test with the given message. | ||
Assert::fileExists | final public static | function | |||
Assert::getCount | final public static | function | Return the current assertion count. | ||
Assert::greaterThan | final public static | function | |||
Assert::greaterThanOrEqual | final public static | function | |||
Assert::identicalTo | final public static | function | |||
Assert::isEmpty | final public static | function | |||
Assert::isFalse | final public static | function | |||
Assert::isFinite | final public static | function | |||
Assert::isInfinite | final public static | function | |||
Assert::isInstanceOf | final public static | function | |||
Assert::isJson | final public static | function | |||
Assert::isList | final public static | function | |||
Assert::isNan | final public static | function | |||
Assert::isNativeType | private static | function | |||
Assert::isNull | final public static | function | |||
Assert::isReadable | final public static | function | |||
Assert::isTrue | final public static | function | |||
Assert::isType | final public static | function | @psalm-param 'array'|'boolean'|'bool'|'double'|'float'|'integer'|'int'|'null'|'numeric'|'object'|'real'|'resource'|'resource… | ||
Assert::isWritable | final public static | function | |||
Assert::lessThan | final public static | function | |||
Assert::lessThanOrEqual | final public static | function | |||
Assert::logicalAnd | final public static | function | |||
Assert::logicalNot | final public static | function | |||
Assert::logicalOr | final public static | function | |||
Assert::logicalXor | final public static | function | |||
Assert::markTestIncomplete | final public static | function | Mark the test as incomplete. | ||
Assert::markTestSkipped | final public static | function | Mark the test as skipped. | ||
Assert::matches | final public static | function | |||
Assert::matchesRegularExpression | final public static | function | |||
Assert::objectEquals | final public static | function | |||
Assert::resetCount | final public static | function | Reset the assertion counter. | ||
Assert::stringContains | final public static | function | |||
Assert::stringEndsWith | final public static | function | @psalm-param non-empty-string $suffix | ||
Assert::stringEqualsStringIgnoringLineEndings | final public static | function | |||
Assert::stringStartsWith | final public static | function | @psalm-param non-empty-string $prefix | ||
ConstraintValidatorTestCase::$call | private | property | |||
ConstraintValidatorTestCase::$constraint | protected | property | |||
ConstraintValidatorTestCase::$context | protected | property | |||
ConstraintValidatorTestCase::$defaultLocale | private | property | |||
ConstraintValidatorTestCase::$defaultTimezone | protected | property | |||
ConstraintValidatorTestCase::$expectedViolations | private | property | |||
ConstraintValidatorTestCase::$group | protected | property | |||
ConstraintValidatorTestCase::$metadata | protected | property | |||
ConstraintValidatorTestCase::$object | protected | property | |||
ConstraintValidatorTestCase::$propertyPath | protected | property | |||
ConstraintValidatorTestCase::$root | protected | property | |||
ConstraintValidatorTestCase::$validator | protected | property | |||
ConstraintValidatorTestCase::$value | protected | property | |||
ConstraintValidatorTestCase::assertNoViolation | protected | function | |||
ConstraintValidatorTestCase::buildViolation | protected | function | |||
ConstraintValidatorTestCase::createContext | protected | function | |||
ConstraintValidatorTestCase::createValidator | abstract protected | function | |||
ConstraintValidatorTestCase::expectFailingValueValidation | protected | function | |||
ConstraintValidatorTestCase::expectNoValidate | protected | function | |||
ConstraintValidatorTestCase::expectValidateAt | protected | function | |||
ConstraintValidatorTestCase::expectValidateValue | protected | function | |||
ConstraintValidatorTestCase::expectValidateValueAt | protected | function | |||
ConstraintValidatorTestCase::expectViolationsAt | protected | function | |||
ConstraintValidatorTestCase::restoreDefaultTimezone | protected | function | |||
ConstraintValidatorTestCase::setDefaultTimezone | protected | function | |||
ConstraintValidatorTestCase::setGroup | protected | function | |||
ConstraintValidatorTestCase::setObject | protected | function | |||
ConstraintValidatorTestCase::setProperty | protected | function | |||
ConstraintValidatorTestCase::setPropertyPath | protected | function | |||
ConstraintValidatorTestCase::setRoot | protected | function | |||
ConstraintValidatorTestCase::setUp | protected | function | This method is called before each test. | Overrides TestCase::setUp | |
ConstraintValidatorTestCase::setValue | protected | function | |||
ConstraintValidatorTestCase::tearDown | protected | function | This method is called after each test. | Overrides TestCase::tearDown | |
TestCase::$backupGlobals | private | property | |||
TestCase::$backupGlobalsExcludeList | private | property | @psalm-var list<string> | ||
TestCase::$backupStaticProperties | private | property | |||
TestCase::$backupStaticPropertiesExcludeList | private | property | @psalm-var array<string,list<class-string>> | ||
TestCase::$customComparators | private | property | @psalm-var list<Comparator> | ||
TestCase::$data | private | property | |||
TestCase::$dataName | private | property | |||
TestCase::$dependencies | private | property | @psalm-var list<ExecutionOrderDependency> | ||
TestCase::$dependencyInput | private | property | |||
TestCase::$doesNotPerformAssertions | private | property | |||
TestCase::$expectedException | private | property | |||
TestCase::$expectedExceptionCode | private | property | |||
TestCase::$expectedExceptionMessage | private | property | |||
TestCase::$expectedExceptionMessageRegExp | private | property | |||
TestCase::$failureTypes | private | property | @psalm-var array<class-string, true> | ||
TestCase::$groups | private | property | @psalm-var list<string> | ||
TestCase::$iniSettings | private | property | @psalm-var array<string,string> | ||
TestCase::$inIsolation | private | property | |||
TestCase::$locale | private | property | |||
TestCase::$mockObjects | private | property | @psalm-var list<MockObjectInternal> | ||
TestCase::$name | private | property | @psalm-var non-empty-string | ||
TestCase::$numberOfAssertionsPerformed | private | property | |||
TestCase::$output | private | property | |||
TestCase::$outputBufferingActive | private | property | |||
TestCase::$outputBufferingLevel | private | property | |||
TestCase::$outputExpectedRegex | private | property | |||
TestCase::$outputExpectedString | private | property | |||
TestCase::$outputRetrievedForAssertion | private | property | |||
TestCase::$preserveGlobalState | private | property | |||
TestCase::$providedTests | private | property | @psalm-var list<ExecutionOrderDependency> | ||
TestCase::$registerMockObjectsFromTestArgumentsRecursively | private | property | |||
TestCase::$runClassInSeparateProcess | private | property | |||
TestCase::$runTestInSeparateProcess | private | property | |||
TestCase::$snapshot | private | property | |||
TestCase::$status | private | property | |||
TestCase::$testResult | private | property | |||
TestCase::$testValueObjectForEvents | private | property | |||
TestCase::$wasPrepared | private | property | |||
TestCase::addToAssertionCount | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::any | final public static | function | Returns a matcher that matches when the method is executed zero or more times. |
||
TestCase::assertPostConditions | protected | function | Performs assertions shared by all tests of a test case. | ||
TestCase::assertPreConditions | protected | function | Performs assertions shared by all tests of a test case. | ||
TestCase::atLeast | final public static | function | Returns a matcher that matches when the method is executed at least N times. |
||
TestCase::atLeastOnce | final public static | function | Returns a matcher that matches when the method is executed at least once. | ||
TestCase::atMost | final public static | function | Returns a matcher that matches when the method is executed at most N times. |
||
TestCase::checkRequirements | private | function | |||
TestCase::cleanupIniSettings | private | function | |||
TestCase::cleanupLocaleSettings | private | function | |||
TestCase::compareGlobalStateSnapshotPart | private | function | |||
TestCase::compareGlobalStateSnapshots | private | function | |||
TestCase::count | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::createConfiguredMock | protected | function | Creates (and configures) a mock object for the specified interface or class. | ||
TestCase::createConfiguredStub | final protected static | function | Creates (and configures) a test stub for the specified interface or class. | ||
TestCase::createGlobalStateSnapshot | private | function | |||
TestCase::createMock | protected | function | Creates a mock object for the specified interface or class. | ||
TestCase::createMockForIntersectionOfInterfaces | protected | function | @psalm-param list<class-string> $interfaces | ||
TestCase::createPartialMock | protected | function | Creates a partial mock object for the specified interface or class. | ||
TestCase::createStub | protected static | function | Creates a test stub for the specified interface or class. | ||
TestCase::createStubForIntersectionOfInterfaces | protected static | function | @psalm-param list<class-string> $interfaces | ||
TestCase::createTestProxy | Deprecated | protected | function | Creates a test proxy for the specified class. | |
TestCase::dataName | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::dataSetAsString | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::dataSetAsStringWithData | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::dependencyInput | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::doesNotPerformAssertions | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::exactly | final public static | function | Returns a matcher that matches when the method is executed exactly $count times. |
||
TestCase::expectedExceptionWasNotRaised | private | function | |||
TestCase::expectException | final public | function | @psalm-param class-string<Throwable> $exception | ||
TestCase::expectExceptionCode | final public | function | |||
TestCase::expectExceptionMessage | final public | function | |||
TestCase::expectExceptionMessageMatches | final public | function | |||
TestCase::expectExceptionObject | final public | function | Sets up an expectation for an exception to be raised by the code under test. Information for expected exception class, expected exception message, and expected exception code are retrieved from a given Exception object. |
||
TestCase::expectNotToPerformAssertions | final public | function | |||
TestCase::expectOutputRegex | final public | function | |||
TestCase::expectOutputString | final public | function | |||
TestCase::expectsOutput | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::getActualOutputForAssertion | final public | function | |||
TestCase::getMockBuilder | final public | function | Returns a builder object to create mock objects using a fluent interface. | ||
TestCase::getMockForAbstractClass | Deprecated | protected | function | Creates a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default. To mock concrete methods, use the 7th parameter ($mockedMethods). |
|
TestCase::getMockForTrait | Deprecated | protected | function | Creates a mock object for the specified trait with all abstract methods of the trait mocked. Concrete methods to mock can be specified with the `$mockedMethods` parameter. |
|
TestCase::getMockFromWsdl | Deprecated | protected | function | Creates a mock object based on the given WSDL file. | |
TestCase::getObjectForTrait | Deprecated | protected | function | Creates an object that uses the specified trait. | |
TestCase::groups | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::handleDependencies | private | function | |||
TestCase::hasDependencyInput | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::hasExpectationOnOutput | private | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::hasUnexpectedOutput | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::iniSet | Deprecated | protected | function | This method is a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run. |
|
TestCase::invokeAfterClassHookMethods | private | function | @codeCoverageIgnore | ||
TestCase::invokeAfterTestHookMethods | private | function | |||
TestCase::invokeBeforeClassHookMethods | private | function | @codeCoverageIgnore | ||
TestCase::invokeBeforeTestHookMethods | private | function | |||
TestCase::invokeHookMethods | private | function | @psalm-param list<non-empty-string> $hookMethods @psalm-param… |
||
TestCase::invokePostConditionHookMethods | private | function | |||
TestCase::invokePreConditionHookMethods | private | function | |||
TestCase::isCallableTestMethod | private | function | |||
TestCase::isRegisteredFailure | private | function | |||
TestCase::LOCALE_CATEGORIES | private | constant | |||
TestCase::markErrorForInvalidDependency | private | function | |||
TestCase::markSkippedForMissingDependency | private | function | |||
TestCase::methodDoesNotExistOrIsDeclaredInTestCase | private | function | |||
TestCase::name | final public | function | @psalm-return non-empty-string | ||
TestCase::nameWithDataSet | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::never | final public static | function | Returns a matcher that matches when the method is never executed. | ||
TestCase::numberOfAssertionsPerformed | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::once | final public static | function | Returns a matcher that matches when the method is executed exactly once. | ||
TestCase::onConsecutiveCalls | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::onNotSuccessfulTest | protected | function | This method is called when a test method did not execute successfully. | ||
TestCase::output | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::performAssertionsOnOutput | private | function | |||
TestCase::providedData | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::provides | final public | function | @psalm-return list<ExecutionOrderDependency> | Overrides Reorderable::provides | |
TestCase::registerComparator | final protected | function | |||
TestCase::registerFailureType | final protected | function | @psalm-param class-string $classOrInterface | ||
TestCase::registerMockObject | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::registerMockObjectsFromTestArguments | private | function | |||
TestCase::registerMockObjectsFromTestArgumentsRecursively | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::requirementsNotSatisfied | private | function | |||
TestCase::requires | final public | function | @psalm-return list<ExecutionOrderDependency> | Overrides Reorderable::requires | |
TestCase::restoreGlobalState | private | function | |||
TestCase::result | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::returnArgument | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::returnCallback | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::returnSelf | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::returnValue | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::returnValueMap | Deprecated | final public static | function | @codeCoverageIgnore | |
TestCase::run | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | Overrides Test::run | |
TestCase::runBare | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::runTest | protected | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setBackupGlobals | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setBackupGlobalsExcludeList | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setBackupStaticProperties | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setBackupStaticPropertiesExcludeList | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setData | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setDependencies | final public | function | @psalm-param list<ExecutionOrderDependency> $dependencies | ||
TestCase::setDependencyInput | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setGroups | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setInIsolation | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setLocale | Deprecated | protected | function | This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run. |
|
TestCase::setName | final public | function | @psalm-param non-empty-string $name | ||
TestCase::setPreserveGlobalState | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setResult | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setRunClassInSeparateProcess | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setRunTestInSeparateProcess | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::setUpBeforeClass | public static | function | This method is called before the first test of this test class is run. | ||
TestCase::shouldExceptionExpectationsBeVerified | private | function | |||
TestCase::shouldInvocationMockerBeReset | private | function | |||
TestCase::shouldRunInSeparateProcess | private | function | |||
TestCase::size | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::snapshotGlobalState | private | function | |||
TestCase::sortId | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | Overrides Reorderable::sortId | |
TestCase::startOutputBuffering | private | function | |||
TestCase::status | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::stopOutputBuffering | private | function | |||
TestCase::tearDownAfterClass | public static | function | This method is called after the last test of this test class is run. | ||
TestCase::throwException | final public static | function | |||
TestCase::toString | public | function | Returns a string representation of the test case. | Overrides SelfDescribing::toString | |
TestCase::transformException | protected | function | |||
TestCase::unregisterCustomComparators | private | function | |||
TestCase::usesDataProvider | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::valueObjectForEvents | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::verifyExceptionExpectations | private | function | |||
TestCase::verifyMockObjects | private | function | |||
TestCase::wasPrepared | final public | function | @internal This method is not covered by the backward compatibility promise for PHPUnit | ||
TestCase::__construct | public | function | @psalm-param non-empty-string $name |