public function testGetById() { $query = $this->getMockupQuery(); $this->queryManager->save($query); $result = $this->queryManager->getById($query->getId()); $getByIdFailedMessage = "ID: " . $query->getId() . " QueryManager could not resolve the query:" . json_encode($query->toArray()); $notEqualErrorMessage = "The saved query is not the same as the one you've got from the database. There must be an error with the saving!"; self::assertNotNull($result, $getByIdFailedMessage); self::assertEquals($query, $result, $notEqualErrorMessage, 0.0, 50); }
public function testSaveQuery() { $query = $this->getQuery(); $this->queryManager->save($query); $query1 = $this->queryManager->getById($query->getId()); self::assertEquals(HKVStorage::encodeValue($query), HKVStorage::encodeValue($query1)); $query1->setName("New Name"); $this->queryManager->save($query1); $query2 = $this->queryManager->getById($query1->getId()); self::assertEquals("New Name", $query2->getName()); }
/** * @Route("{id}/get") * @param int $int * @Method("GET") * @return Response */ public function get($id) { if ($this->securityContext->isUserAllowedToView($this->user)) { $styleMap = $this->queryManager->getById($id); if ($styleMap != null) { return $this->getSuccessMessage($styleMap); } else { return $this->getEmptyMessage($id); } } return $this->getErrorMessage("Get: Current user is not authorized to access style w ith id " . $id, HTTPStatusConstants::_UNAUTHORIZED); }