Luciano Andrade 7 years ago
parent
commit
331c3eadf6

+ 0 - 2
src/FTTHBundle/Controller/ONURESTController.php

@@ -147,8 +147,6 @@ class ONURESTController extends RESTController
      */
     public function applyAction(Request $request, ONU $entity, String $workflow, String $transition)
     {
-	$entity->setAdministrativeState("suspend");
-	return $entity;
         try {
 
 	    $wr = $this->container->get("workflow.registry");

+ 8 - 2
src/FTTHBundle/tests/ONURESTControllerTest.php

@@ -41,6 +41,11 @@ class ONURESTControllerTest extends WebTestCaseBase
             json_encode(array(array("name" => "Stock", "id" => 1)));
         $datos['api/devices/check'] =
             json_encode(array(array('result' => true, 'errors' => null)));
+	$datos['api/devices'] =
+            json_encode(array(array('name' => true, 'errors' => null)));
+
+
+
         return $datos;
     }
 
@@ -193,14 +198,15 @@ class ONURESTControllerTest extends WebTestCaseBase
 
 	$this->assertEquals("active", $json["administrativeState"]);
 
+        $this->initDefault($this->obtainDataWebService());
+
 	$this->getClient()->request('PATCH',
 		$this->getUriPutDelete(). "apply/". $json["id"] . "/administrative_state/active_to_suspend.json" , array());
         $response = $this->getClient()->getResponse();
 
 	$json = json_decode($response->getContent(), true);
-	$json = $json[0];
 
-        $this->assertEquals(200, $response->getStatusCode(), "Error en la respuesta http.");
+        $this->assertEquals(201, $response->getStatusCode(), "Error en la respuesta http.");
 	$this->assertEquals("suspend", $json["administrativeState"]);
 
         $response = $this->getClient()->getResponse();