CustomerZipCodeValidator example

protected function setUp(): void
    {
        $this->constraint = new CustomerZipCode([
            'countryId' => Uuid::randomHex(),
        ]);

        $this->countryRepository = $this->createMock(EntityRepository::class);
    }

    public function testUnexpectedTypeException(): void
    {
        $mock = new CustomerZipCodeValidator($this->countryRepository);

        try {
            $mock->validate(['zipcode' => '1235468']$this->createMock(Constraint::class));
        } catch (\Throwable $exception) {
            static::assertInstanceOf(UnexpectedTypeException::class$exception);
        }
    }

    public function testValidateWithoutCountryId(): void
    {
        $this->countryRepository->expects(static::never())->method('search');

        
Home | Imprint | This part of the site doesn't use cookies.