Browse Source

Per 1.1 spec JSON Feed will remain compatible

master
J. King 5 years ago
parent
commit
e16492d7f7
  1. 2
      lib/Parser/JSON/Feed.php
  2. 15
      tests/cases/JSON/failures.json

2
lib/Parser/JSON/Feed.php

@ -50,8 +50,6 @@ class Feed implements \JKingWeb\Lax\Parser\Feed {
throw new Exception("notJSON");
} elseif (!isset($data->version) || !preg_match("<^https://jsonfeed\.org/version/(\d+(?:\.\d+)?)$>", $data->version, $match)) {
throw new Exception("notJSONFeed");
} elseif (version_compare($match[1], "1", "<") || version_compare($match[1], "2", ">=")) {
throw new Exception("unsupportedJSONFeedVersion");
}
$this->data = $data;
$this->version = $match[1];

15
tests/cases/JSON/failures.json

@ -29,20 +29,5 @@
"description": "Not a JSON feed 3",
"input": {"version": "https://jsonfeed.org/version/"},
"exception": "notJSONFeed"
},
{
"description": "Unknown version 1",
"input": {"version": "https://jsonfeed.org/version/2"},
"exception": "unsupportedJSONFeedVersion"
},
{
"description": "Unknown version 2",
"input": {"version": "https://jsonfeed.org/version/11"},
"exception": "unsupportedJSONFeedVersion"
},
{
"description": "Unknown version 3",
"input": {"version": "https://jsonfeed.org/version/0.1"},
"exception": "unsupportedJSONFeedVersion"
}
]
Loading…
Cancel
Save