diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3d110a576e..8d8235fad7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: jobs: cs-fix: name: Run code style check - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" strategy: matrix: php: @@ -35,7 +35,7 @@ jobs: tests: name: Unit tests & SQLite integration tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" timeout-minutes: 15 strategy: @@ -90,7 +90,7 @@ jobs: --health-timeout 5s --health-retries 5 --tmpfs /var/lib/postgres - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" timeout-minutes: 60 strategy: @@ -145,7 +145,7 @@ jobs: --health-timeout=5s --health-retries=5 --tmpfs=/var/lib/mysql - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" timeout-minutes: 60 strategy: @@ -182,7 +182,7 @@ jobs: solr-integration: name: "Solr integration tests" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" timeout-minutes: 30 permissions: packages: read diff --git a/src/contracts/Validation/StructWrapperValidator.php b/src/contracts/Validation/StructWrapperValidator.php index 5a80f5d5fa..2e8483f508 100644 --- a/src/contracts/Validation/StructWrapperValidator.php +++ b/src/contracts/Validation/StructWrapperValidator.php @@ -74,12 +74,12 @@ public function validate($value, $constraints = null, $groups = null): Constrain public function validateProperty(object $object, string $propertyName, $groups = null): ConstraintViolationListInterface { - return $this->inner->validatePropertyValue($object, $propertyName, $groups); + return $this->inner->validateProperty($object, $propertyName, $groups); } public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null): ConstraintViolationListInterface { - return $this->inner->validatePropertyValue($objectOrClass, $propertyName, $groups); + return $this->inner->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); } public function startContext(): ContextualValidatorInterface diff --git a/tests/lib/Validation/StructWrapperValidatorTest.php b/tests/lib/Validation/StructWrapperValidatorTest.php index ea75c6beed..154d8c827b 100644 --- a/tests/lib/Validation/StructWrapperValidatorTest.php +++ b/tests/lib/Validation/StructWrapperValidatorTest.php @@ -108,6 +108,39 @@ public function testAssertValidStructWithInvalidWrapperStruct(): void self::assertSame('property', $error->getPropertyPath()); } + public function testValidateProperty(): void + { + $initialError = $this->createExampleConstraintViolation(); + $initialErrors = $this->createExampleConstraintViolationList($initialError); + + $object = new stdClass(); + $propertyName = 'foobar'; + $group = ['Default', 'group']; + $this->validator->expects(self::once()) + ->method('validateProperty') + ->with($object, $propertyName, $group) + ->willReturn($initialErrors); + + $this->structValidator->validateProperty($object, $propertyName, $group); + } + + public function testValidatePropertyValue(): void + { + $initialError = $this->createExampleConstraintViolation(); + $initialErrors = $this->createExampleConstraintViolationList($initialError); + + $object = new stdClass(); + $propertyName = 'foobar'; + $value = 'someValue'; + $group = ['Default', 'group']; + $this->validator->expects(self::once()) + ->method('validatePropertyValue') + ->with($object, $propertyName, $value, $group) + ->willReturn($initialErrors); + + $this->structValidator->validatePropertyValue($object, $propertyName, $value, $group); + } + private function createExampleConstraintViolation(): ConstraintViolationInterface { return new ConstraintViolation(