Country example

\Locale::setDefault($this->defaultLocale);
    }

    protected function createValidator(): CountryValidator
    {
        return new CountryValidator();
    }

    public function testNullIsValid()
    {
        $this->validator->validate(null, new Country());

        $this->assertNoViolation();
    }

    public function testEmptyStringIsValid()
    {
        $this->validator->validate('', new Country());

        $this->assertNoViolation();
    }

    
new IdenticalTo(['value' => 7]),
            ]],
            [-3, [
                new DivisibleBy(['value' => 4]),
                new Negative(),
            ]],
            ['FOO', [
                new Choice(['choices' => ['bar', 'BAR']]),
                new Regex(['pattern' => '/foo/i']),
            ]],
            ['fr', [
                new Country(),
                new Language(),
            ]],
            [[1, 3, 5][
                new Count(['min' => 5]),
                new Unique(),
            ]],
        ];
    }

    /** * @dataProvider getInvalidCombinations */
$area->setId((int) $data['__countryArea_id']);
        $area->setName($data['__countryArea_name']);

        return $area;
    }

    /** * @return Country */
    public function hydrateCountry(array $data)
    {
        $country = new Country();
        $id = (int) $data['__country_id'];

        $translation = $this->getTranslation($data, '__country', []$id);
        $data = array_merge($data$translation);

        $country->setId($id);
        $country->setName($data['__country_countryname']);

        if (isset($data['__country_countryiso'])) {
            $country->setIso($data['__country_countryiso']);
        }

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