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);
 }
 public function setUp()
 {
     $this->setApplicationConfig(include realpath(__DIR__) . '/../../../../config/application.config.php');
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->event = new MvcEvent();
     $this->routeMatch = new RouteMatch(array('controller' => 'authentication'));
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator(Bootstrap::getServiceManager());
     parent::setUp();
 }
Beispiel #3
0
        if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`');
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
    public static function createStructureDatabase()
    {
        print_r("Criando a estrutura de dados de acordo com as entidades mapeadas.\n");
        $entityManager = self::getServiceManager()->get('Doctrine\\ORM\\EntityManager');
        $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
        $classes = $entityManager->getMetadataFactory()->getAllMetadata();
        $schemaTool->updateSchema($classes);
        print_r("Iniciando os testes unitários.\n\n");
    }
}
Bootstrap::init();
Bootstrap::chroot();
 private function getServiceAuthentication()
 {
     $serviceManager = Bootstrap::getServiceManager();
     return $serviceManager->get('Authentication\\Service\\Authentication');
 }
 /**
  * @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 getListInformationValid()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $servicePessoaFisica = $serviceManager->get('Pessoa\\Service\\PessoaFisica');
     $arrData = array('dsEmail' => String::generateRandomExpression(100) . '@gmail.com', 'dsNome' => String::generateRandomExpression(255), 'dsCpf' => GenerateTest::cpfRandom(), 'dsLogin' => null, 'datAniversario' => date('d/m/Y'), 'idPessoaFisica' => null);
     $pessoaFisica = $servicePessoaFisica->save($arrData);
     return array(array($pessoaFisica->getDsCpf(), $pessoaFisica->getDsEmail()));
 }
Beispiel #7
0
 /**
  *
  * @return type
  */
 private function getServicePessoa()
 {
     $serviceManager = Bootstrap::getServiceManager();
     return $serviceManager->get('Pessoa\\Service\\PessoaFisica');
 }
 protected function tearDown()
 {
     Bootstrap::getServiceManager()->get('Doctrine\\ORM\\EntityManager')->getConnection()->rollback();
     parent::tearDown();
 }