Exemplo n.º 1
0
 public function loadExpectationFromFile($fileName)
 {
     $this->logger->debug("Loading expectation file {$fileName}");
     $content = file_get_contents($fileName);
     $data = @json_decode($content, true);
     if (json_last_error() != JSON_ERROR_NONE) {
         throw new \Exception(json_last_error_msg());
     }
     $expectation = $this->requestBuilder->parseRequest($data, Expectation::class, RequestBuilder::RETURN_ALL_ERRORS_IN_EXCEPTION);
     $this->validateExpectationOrThrowException($expectation, $this->logger);
     $this->logger->debug('Parsed expectation: ' . var_export($expectation, true));
     $this->storage->addExpectation($expectation);
 }