protected function insertLogin($strLogin, $strNovaSenha) { $serviceManager = Bootstrap::getServiceManager(); $serviceConfiguracaoEmail = $serviceManager->get('Mensageria\\Service\\ConfiguracaoEmail'); $serviceConfiguracaoEmail->save(array('dsComplemento' => String::generateRandomExpression(5), 'dsEmail' => String::generateRandomExpression(5), 'dsPassword' => String::generateRandomExpression(5), 'dsSmtp' => String::generateRandomExpression(5), 'dsUsuario' => String::generateRandomExpression(5))); $arrDataPessoa = array('dsEmail' => $strLogin, 'dsNome' => $strLogin, 'dsCpf' => '11111111111', 'datAniversario' => date('d/m/Y'), 'dsLogin' => $strLogin, 'idPessoaFisica' => null); $pessoaFisica = $serviceManager->get('Pessoa\\Service\\PessoaFisica')->save($arrDataPessoa); $serviceManager->get('Authentication\\Service\\Authentication')->alterarSenha($pessoaFisica->getIdPessoaFisica(), $strNovaSenha); }
protected function getCadastroPessoaFisica() { if (self::$pessoaFisica) { return self::$pessoaFisica; } $serviceManager = Bootstrap::getServiceManager(); $strEmail = String::generateRandomExpression(10) . '@gmail.com'; $pessoaFisica = $serviceManager->get('Pessoa\\Service\\PessoaFisica')->save(array('dsEmail' => $strEmail, 'dsNome' => String::generateRandomExpression(255), 'dsCpf' => GenerateTest::cpfRandom(), 'dsLogin' => null, 'datAniversario' => date('d/m/Y'), 'idPessoaFisica' => null)); self::$pessoaFisica = $pessoaFisica; return self::$pessoaFisica; }
/** * Metodo responsavel para realizar operacoes apos de salvar. * * @param type $arrData * @param type $pessoaFisica */ protected function posSave($arrData, PessoaFisicaEntity $pessoaFisica) { # Salvando informacao do login if ($arrData['dsLogin']) { $serviceLogin = $this->getService('Authentication\\Service\\Authentication'); $arrDataLoginSave = $serviceLogin->findBy(array('idPessoaFisica' => $pessoaFisica->getIdPessoaFisica())); if ($arrDataLoginSave) { return $arrDataLoginSave; } $arrDataLogin = array('dsLogin' => $arrData['dsLogin'], 'dsPassword' => String::generateRandomExpression(8, true), 'idPessoaFisica' => $pessoaFisica->getIdPessoaFisica()); $serviceLogin->save($arrDataLogin); $strTexto = $serviceLogin->getTextCadastroLogin($pessoaFisica->getDsNome(), $arrDataLogin['dsLogin'], $arrDataLogin['dsPassword']); return $this->registroEnvioEmail($pessoaFisica, 'SHOME2 :: Cadastro de Usuário', $strTexto); } return false; }
/** * @test * @covers \Perfil\Controller\IndexController::ajaxAlterarSituacaoAction() * @depends addActionPost */ public function ajaxAlterarSituacaoPost() { Bootstrap::getServiceManager()->get('Doctrine\\ORM\\EntityManager')->getConnection()->beginTransaction(); $serviceManager = Bootstrap::getServiceManager(); $servicePerfil = $serviceManager->get('Perfil\\Service\\Perfil'); $perfil = $servicePerfil->save(array('noPerfil' => String::generateRandomExpression(255), 'dsPerfil' => String::generateRandomExpression(255), 'idPerfil' => '')); $parameter = new Parameters(array('idPerfil' => $perfil->getIdPerfil())); $this->getRequest()->setMethod('POST'); $this->getRequest()->setPost($parameter); $this->dispatch('/perfil/ajaxAlterarSituacao'); $this->assertResponseStatusCode(200); Bootstrap::getServiceManager()->get('Doctrine\\ORM\\EntityManager')->getConnection()->rollback(); }
public function getListInformationInvalid() { return array(array(GenerateTest::cnpjRandom(), String::generateRandomExpression(10) . '@gmail.com'), array(GenerateTest::cnpjRandom(true), String::generateRandomExpression(10) . '@gmail.com')); }
/** * Metodo responsavel em formatar uma string nas mascaras de TELEFONE. * * @example \CoreZend\Util\Format::formatPhone('1111111111'); <br /> \CoreZend\Util\Format::formatPhone('22222222'); <br /> \CoreZend\Util\Format::formatPhone('12345123'); * * @param string $strValue * @return string * * @assert ('02345123456') === str_replace(' ', ' ', '(023) 4512-3456') * @assert ('1234512345') === str_replace(' ', ' ', '(12) 3451-2345') * @assert ('12345123') === '1234-5123' * @assert ('1234512') === '1234512' * @assert ('(11) 1111-1111') === str_replace(' ', ' ', '(11) 1111-1111') */ public static function formatPhone($strValue) { if (!String::isNullEmpty($strValue)) { if (strlen($strValue) == 11) { $strPattern = '/(\\d{3})(\\d{4})(\\d*)/'; $strValue = preg_replace($strPattern, '($1) $2-$3', $strValue); } else { if (strlen($strValue) == 10) { $strPattern = '/(\\d{2})(\\d{4})(\\d*)/'; $strValue = preg_replace($strPattern, '($1) $2-$3', $strValue); } else { if (strlen($strValue) == 8) { $strPattern = '/(\\d{4})(\\d*)/'; $strValue = preg_replace($strPattern, '$1-$2', $strValue); } } } } return $strValue; }
/** * * @return type */ public function getDadosPessoaValido() { $serviceManager = Bootstrap::getServiceManager(); $serviceConfiguracaoEmail = $serviceManager->get('Mensageria\\Service\\ConfiguracaoEmail'); $serviceConfiguracaoEmail->save(array('dsComplemento' => String::generateRandomExpression(5), 'dsEmail' => String::generateRandomExpression(5), 'dsPassword' => String::generateRandomExpression(5), 'dsSmtp' => String::generateRandomExpression(5), 'dsUsuario' => String::generateRandomExpression(5))); return array(array(array('dsEmail' => String::generateRandomExpression(100) . '@gmail.com', 'dsNome' => String::generateRandomExpression(255), 'dsCpf' => GenerateTest::cpfRandom(), 'datAniversario' => date('d/m/Y'), 'dsLogin' => GenerateTest::cpfRandom(), 'idPessoaFisica' => null))); }