public function testUpdateProperties() { $this->branchRepository->expects($this->once())->method('get')->will($this->returnValue($this->branch)); $name = 'DUMMY_NAME_UPDT'; $description = 'DUMMY_DESC_UPDT'; $this->branch->expects($this->at(0))->method('updateProperty')->with($this->equalTo('name'), $this->equalTo($name)); $this->branch->expects($this->at(1))->method('updateProperty')->with($this->equalTo('description'), $this->equalTo($description)); $this->branchRepository->expects($this->once())->method('store')->with($this->equalTo($this->branch)); $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo('Entity:DiamanteDeskBundle:Branch'))->will($this->returnValue(true)); $command = new UpdatePropertiesCommand(); $command->id = 1; $command->properties = ['name' => $name, 'description' => $description]; $this->branchServiceImpl->updateProperties($command); }
/** * Update certain properties of the Branch * * @ApiDoc( * description="Update branch", * uri="/branches/{id}.{_format}", * method={ * "PUT", * "PATCH" * }, * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Branch Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to update branch", * 404="Returned when the branch is not found" * } * ) * * @param Command\UpdatePropertiesCommand $command * @return \Diamante\DeskBundle\Model\Branch\Branch */ public function updateProperties(Command\UpdatePropertiesCommand $command) { return parent::updateProperties($command); }