Exemplo n.º 1
0
 public function testIndexWithInvalidRequest()
 {
     // Exceções Esperadas
     $this->setExpectedException('Exception', 'Invalid Request');
     // Inicialização
     $element = new Configs();
     // Configurar Parâmetros de Despacho
     $element->getEvent()->setRouteMatch(new Router\RouteMatch(['action' => 'index']));
     // Execução
     $element->dispatch($this->getMock('Zend\\Stdlib\\RequestInterface'));
 }
Exemplo n.º 2
0
 public function testModulesAndSaveWithErrors()
 {
     // Inicialização
     $element = new Configs();
     // Localizador de Serviços
     $serviceLocator = new ServiceManager();
     $element->setServiceLocator($serviceLocator);
     // Camada de Modelo
     $mModules = $this->getMock('Balance\\Model\\Modules');
     // Salvar com Dados Corretos
     $mModules->expects($this->once())->method('save')->will($this->throwException(new ModelException()));
     // Serviço
     $serviceLocator->setService('Balance\\Model\\Modules', $mModules);
     // Configurar Parâmetros de Despacho
     $element->getEvent()->setRouteMatch(new Router\RouteMatch(['action' => 'modules']));
     // Requisição
     $request = (new Http\PhpEnvironment\Request())->setMethod('POST');
     // Execução
     $element->dispatch($request);
 }