diff options
| author | 2024-01-10 08:23:45 +0100 | |
|---|---|---|
| committer | 2024-01-10 08:23:45 +0100 | |
| commit | 9c97d8ca729e3cfb067445c0d3c9ad8284132aeb (patch) | |
| tree | 256588d7a65cc8658c808bc7852c816f6ccc1cd2 /tests | |
| parent | 9a80dde238caf1338b803f67003cd459393efdc3 (diff) | |
JSONFeeds, JSON scraping, and POST requests for feeds (#5662)
* allow POST requests for feeds
* added json dotpath and jsonfeed subscriptions. No translation strings yet
* debug and fix jsonfeed parser
* bugfix params saved when editing feed
* added translations for JSON features
* Update docs for web scraping
* make fix-all
and revert unrelated changes, plus a few manual fixes, but there are still several type errors
* Fix some i18n
* refactor json parsing for both feed types
* cleanup unnecessary comment
* refactored generation of SimplePie for XPath and JSON feeds
* Fix merge error
* Update to newer FreshRSS code
* A bit of refactoring
* doc, whitespace
* JSON Feed is in two words
* Add support for array syntax
* Whitespace
* Add OPML export/import
* Work on i18n
* Accept application/feed+json
* Rework POST
* Fix update
* OPML for cURL options
* Fix types
* Fix Typos
---------
Co-authored-by: Erion Elmasllari <elmasllari@factorsixty.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/app/Utils/dotpathUtilTest.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/app/Utils/dotpathUtilTest.php b/tests/app/Utils/dotpathUtilTest.php new file mode 100644 index 000000000..e4eab3041 --- /dev/null +++ b/tests/app/Utils/dotpathUtilTest.php @@ -0,0 +1,44 @@ +<?php +declare(strict_types=1); + +class dotpathUtilTest extends PHPUnit\Framework\TestCase { + + /** + * @return Traversable<array{array<string,mixed>,string,mixed}> + */ + public function provideJsonDots(): Traversable { + $json = <<<json + { + "hello": "world", + "deeper": { + "hello": "again" + }, + "items": [ + { + "meta": {"title": "first"} + }, + { + "meta": {"title": "second"} + } + ] + } + json; + $array = json_decode($json, true); + + yield [$array, 'hello', 'world']; + yield [$array, 'deeper.hello', 'again']; + yield [$array, 'items.0.meta.title', 'first']; + yield [$array, 'items[0].meta.title', 'first']; + yield [$array, 'items.1.meta.title', 'second']; + yield [$array, 'items[1].meta.title', 'second']; + } + + /** + * @dataProvider provideJsonDots + * @param array<string,mixed> $array + */ + public function testJsonDots(array $array, string $key, mixed $expected): void { + $value = FreshRSS_dotpath_Util::get($array, $key); + self::assertEquals($expected, $value); + } +} |
