|
@@ -22,6 +22,22 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
return '/api/onus.json';
|
|
return '/api/onus.json';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @return string Retorna la uri a consultar.
|
|
|
|
+ */
|
|
|
|
+ protected function getOLTUri()
|
|
|
|
+ {
|
|
|
|
+ return '/api/olts.json';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return string Retorna la uri a consultar.
|
|
|
|
+ */
|
|
|
|
+ protected function getNAPUri()
|
|
|
|
+ {
|
|
|
|
+ return '/api/naps.json';
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @return string Retorna la uri a consultar.
|
|
* @return string Retorna la uri a consultar.
|
|
*/
|
|
*/
|
|
@@ -81,6 +97,54 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Genera los datos a manipular.
|
|
|
|
+ * @param string $key Contiene la key a buscar en los datos.
|
|
|
|
+ * @return array|string Retorna el array con los datos o el valor de la key pasada como parametro.
|
|
|
|
+ * @throws \Exception Lanza un excepcion en caso de no encontrar la key.
|
|
|
|
+ */
|
|
|
|
+ protected function obtainNAPData($key = null)
|
|
|
|
+ {
|
|
|
|
+ $datos = array();
|
|
|
|
+ $datos['olt'] = 1;
|
|
|
|
+ $datos['name'] = 'NAP';
|
|
|
|
+ $datos['tenancyId'] = 1;
|
|
|
|
+
|
|
|
|
+ if ($key == null) {
|
|
|
|
+ return $datos;
|
|
|
|
+ } else {
|
|
|
|
+ if (isset($datos[$key])) {
|
|
|
|
+ return $datos[$key];
|
|
|
|
+ } else {
|
|
|
|
+ throw new \Exception("No se seteo la key del dato a obtener. key=" . $key);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Genera los datos a manipular.
|
|
|
|
+ * @param string $key Contiene la key a buscar en los datos.
|
|
|
|
+ * @return array|string Retorna el array con los datos o el valor de la key pasada como parametro.
|
|
|
|
+ * @throws \Exception Lanza un excepcion en caso de no encontrar la key.
|
|
|
|
+ */
|
|
|
|
+ protected function obtainOLTData($key = null)
|
|
|
|
+ {
|
|
|
|
+ $datos = array();
|
|
|
|
+ $datos['name'] = 'OLT';
|
|
|
|
+ $datos['ip'] = '127.0.0.1';
|
|
|
|
+ $datos['tenancyId'] = 1;
|
|
|
|
+
|
|
|
|
+ if ($key == null) {
|
|
|
|
+ return $datos;
|
|
|
|
+ } else {
|
|
|
|
+ if (isset($datos[$key])) {
|
|
|
|
+ return $datos[$key];
|
|
|
|
+ } else {
|
|
|
|
+ throw new \Exception("No se seteo la key del dato a obtener. key=" . $key);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Realiza una busqueda.
|
|
* Realiza una busqueda.
|
|
* get_onus -> /api/onus.{_format}
|
|
* get_onus -> /api/onus.{_format}
|
|
@@ -132,6 +196,8 @@ class ONURESTControllerTest extends WebTestCaseBase
|
|
// seteo los datos del listener
|
|
// seteo los datos del listener
|
|
$this->setListener();
|
|
$this->setListener();
|
|
// hago la inserccion llamando al servicio por post
|
|
// hago la inserccion llamando al servicio por post
|
|
|
|
+ $this->getClient()->request('POST', $this->getOLTUri(), $this->obtainOLTData());
|
|
|
|
+ $this->getClient()->request('POST', $this->getNAPUri(), $this->obtainNAPData());
|
|
$this->getClient()->request('POST', $this->getUri(), $this->obtainData());
|
|
$this->getClient()->request('POST', $this->getUri(), $this->obtainData());
|
|
// obtengo la respuesta
|
|
// obtengo la respuesta
|
|
$response = $this->getClient()->getResponse();
|
|
$response = $this->getClient()->getResponse();
|