HappyPathValidator example


        $inner = $this->createMock(ValidatorInterface::class);

        if ($isValid) {
            $inner->expects(static::never())->method('validate');
        } else {
            $inner->expects(static::atLeastOnce())->method('validate')->willReturn(new ConstraintViolationList([
                $this->createMock(ConstraintViolationInterface::class),
            ]));
        }

        $validator = new HappyPathValidator($inner);
        $list = $validator->validate($value$constraint);

        $isEmpty = $list->count() === 0;
        static::assertSame($isValid$isEmpty);
    }

    public static function constraintDataProvider(): \Generator
    {
        yield 'min range valid' => [
            new Range(['min' => 11]),
            11,
            
Home | Imprint | This part of the site doesn't use cookies.