Example #1
0
 public function getResult($query)
 {
     if (!$query instanceof ParsedQuery) {
         $query = new ParsedQuery($query);
     }
     $result = isset($this->queries[$query->getHash()]) ? $this->queries[$query->getHash()] : null;
     if ($result instanceof Result) {
         return $result;
     } else {
         throw new Exception("Attempting an operation on an un-mocked query is not allowed");
     }
 }
Example #2
0
 public function getResult($query)
 {
     if (!$query instanceof ParsedQuery) {
         $query = new ParsedQuery($query);
     }
     $parsedQuery = $query->getParsedQuery();
     if (isset($parsedQuery['INSERT']) || isset($parsedQuery['UPDATE'])) {
         return new Result();
     }
     if (!isset($this->queries[$query->getHash()])) {
         throw new \Exception('Mock is not specified for query: ' . $query->getRawQuery());
     }
     $result = $this->queries[$query->getHash()];
     if ($result instanceof Result) {
         return $result;
     } else {
         throw new Exception("Attempting an operation on an un-mocked query is not allowed");
     }
 }