/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->session = new NashEarlySession(self::$config["authenticationPath"], self::$config['servicePath']); $this->session->login(self::$config); $this->object = new CentroResultadosService($this->session); $empresaService = new EmpresaService($this->session); $empresa = $empresaService->getEmpresasSelecionaveis(1, 0)[0]; $empresaService->selecionaEmpresa($empresa->getId()); }
<?php require_once '../bootstrap.php'; $config = (require '../config.php'); $config = $config[$config['running']]; $servicePath = $config['servicePath']; $authenticationPath = $config['authenticationPath']; $session = new NashEarlySession($authenticationPath, $servicePath); $service = new MunicipioService($session); $empresaService = new EmpresaService($session); $session->login($config); $empresas = $empresaService->getEmpresasSelecionaveis(1, 0); $empresaService->selecionaEmpresa($empresas[0]->getId()); $result = $service->retrieve(10, 0); //Terceiro parâmentro de filtro opcional $municipios = $result->getModel()->Data; echo "\r\nTotal de Registros: {$result->getModel()->Total}\r\n"; echo "Total Apresentado: " . count($result->getModel()->Data) . "\r\n"; print_r($municipios); $session->logout();
/** * @covers EmpresaService::selecionaEmpresa * @depends testGetEmpresasSelecionaveis */ public function testSelecionaEmpresa(Empresa $empresa) { $result = $this->object->selecionaEmpresa($empresa->getId()); $this->assertEquals(Result::SUCCESS, $result->getStatus()); }