Ejemplo n.º 1
0
 public function testValidateValue()
 {
     $val = new CpfValidator();
     $this->assertFalse($val->validate('7895422'));
     $this->assertFalse($val->validate('11111111111'));
     $this->assertFalse($val->validate('111.111.111-11'));
     $this->assertFalse($val->validate('234.567.058-4_'));
     $this->assertFalse($val->validate('222.451.811-08'));
     $this->assertFalse($val->validate('22245181108'));
     $this->assertTrue($val->validate('222.451.811-07'));
     $this->assertTrue($val->validate('22245181107'));
 }
Ejemplo n.º 2
0
 public function rules()
 {
     return [[['price_range', 'automatic_transfer', 'address', 'cep', 'city', 'state', 'telephone', 'bank', 'bank_ag', 'account_type', 'bank_cc'], 'required', 'on' => 'request_verification'], [['company_name', 'business_type', 'person_type', 'name', 'resp_name', 'city', 'state'], 'string', 'max' => 255], [['address'], 'string', 'max' => 512], [['bank_ag'], 'string', 'max' => 12], [['physical_products', 'automatic_transfer'], 'boolean'], [['automatic_transfer'], 'default', 'value' => true], [['price_range'], 'in', 'range' => array_keys(self::getPriceRanges())], [['person_type'], 'in', 'range' => array_keys(self::getPersonTypes())], [['bank'], 'in', 'range' => array_keys(self::getBanks())], [['account_type'], 'in', 'range' => array_keys(self::getAccountTypes())], [['cnpj'], CnpjValidator::className()], [['cpf', 'resp_cpf'], CpfValidator::className()], [['cnpj', 'company_name', 'resp_name', 'resp_cpf'], 'when' => function ($model) {
         return $model->person_type === self::PERSONTYPE_JURIDICA;
     }], [['cpf', 'name'], 'when' => function ($model) {
         return $model->person_type === self::PERSONTYPE_FISICA;
     }]];
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['edital', 'numeroInscricao', 'cargo', 'nome', 'cpf', 'datanascimento', 'sexo', 'email', 'telefone', 'data', 'termoAceite'], 'required'], ['cpf', 'unique', 'targetAttribute' => ['edital', 'cpf', 'cargo'], 'message' => '"{value} Já utilizado para o edital e cargo selecionado"'], ['cpf', CpfValidator::className()], [['idade', 'deficiencia'], 'integer'], [['datanascimento', 'data', 'idadeModel', 'classificado'], 'safe'], [['edital', 'numeroInscricao', 'identidade', 'orgao_exped'], 'string', 'max' => 45], [['nome', 'cargo', 'email', 'emailAlt'], 'string', 'max' => 100], [['email', 'emailAlt'], 'email'], [['cpf', 'sexo', 'telefone', 'telefoneAlt'], 'string', 'max' => 20], [['deficiencia_cid'], 'string', 'max' => 10]];
 }