public function testValidateCountryCode() { $this->assertEquals('US', RestValidatorHelper::validate_country_code(['cc' => 'US'], 'cc')); $this->assertEquals(null, RestValidatorHelper::validate_country_code([], 'cc', ['required' => false])); TestHelper::assertException(function () { RestValidatorHelper::validate_country_code(['cc' => 'FOO'], 'cc'); }, 'ValidationException'); TestHelper::assertException(function () { RestValidatorHelper::validate_country_code([], 'cc'); }, 'ValidationException'); }