Guillermo Espinoza 7 anni fa
parent
commit
4b6e6e4ff6

+ 0 - 1
src/CablemodemBundle/Entity/Cablemodem.php

@@ -87,7 +87,6 @@ class Cablemodem implements DeviceInterface, TenancyIdTraitInterface, LocationIn
 
 
     /**
     /**
      * @ORM\ManyToOne(targetEntity="Profile", fetch="EXTRA_LAZY")
      * @ORM\ManyToOne(targetEntity="Profile", fetch="EXTRA_LAZY")
-     * @ORM\JoinColumn(nullable=false)
      *
      *
      * @JMS\MaxDepth(1)
      * @JMS\MaxDepth(1)
      *
      *

+ 40 - 0
src/CablemodemBundle/tests/CablemodemRESTControllerTest.php

@@ -14,6 +14,14 @@ use Symfony\Bundle\FrameworkBundle\Client;
  */
  */
 class CablemodemRESTControllerTest extends WebTestCaseBase
 class CablemodemRESTControllerTest extends WebTestCaseBase
 {
 {
+    /**
+     * @return string Retorna la uri a consultar.
+     */
+    protected function getUriProfiles()
+    {
+        return '/api/profiles.json';
+    }
+
     /**
     /**
      * @return string Retorna la uri a consultar.
      * @return string Retorna la uri a consultar.
      */
      */
@@ -49,6 +57,37 @@ class CablemodemRESTControllerTest extends WebTestCaseBase
         $datos['transitionState'] = 'activo';
         $datos['transitionState'] = 'activo';
         $datos['extraData'] = '';
         $datos['extraData'] = '';
         $datos['tenancyId'] = 1;
         $datos['tenancyId'] = 1;
+        $datos['profile'] = 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 obtainDataProfiles($key = null)
+    {
+        $datos = [
+            'name' => 'Profile',
+            'downstream' => null,
+            'upstream' => null,
+            'filtroUpload' => null,
+            'filtroDownload' => null,
+            'maxCpe' => null,
+            'tenancyId' => 1,
+        ];
 
 
         if ($key == null) {
         if ($key == null) {
             return $datos;
             return $datos;
@@ -95,6 +134,7 @@ class CablemodemRESTControllerTest extends WebTestCaseBase
     {
     {
         // inicializo con los datos del webservicemock
         // inicializo con los datos del webservicemock
         $this->initDefault();
         $this->initDefault();
+        $this->getClient()->request('POST', $this->getUriProfile(), $this->obtainDataProfile());
         // hago la inserccion llamando al servicio por post
         // hago la inserccion llamando al servicio por post
         $this->getClient()->request('POST', $this->getUri(), $this->obtainData());
         $this->getClient()->request('POST', $this->getUri(), $this->obtainData());
         // obtengo la respuesta
         // obtengo la respuesta