diff options
-rwxr-xr-x | custom/views/default/sidebar.tpl.php | 4 | ||||
-rw-r--r-- | public/opml/index.php | 10 | ||||
-rw-r--r-- | tests/InstallTest.php | 20 |
3 files changed, 32 insertions, 2 deletions
diff --git a/custom/views/default/sidebar.tpl.php b/custom/views/default/sidebar.tpl.php index 13ae626..9e4bc07 100755 --- a/custom/views/default/sidebar.tpl.php +++ b/custom/views/default/sidebar.tpl.php @@ -14,14 +14,14 @@ usort($all_people, array('PlanetFeed', 'compare')); <?php endforeach; ?> </ul> <p> - <img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="custom/people.opml"><?=_g('All feeds in OPML format')?></a> + <img src="custom/img/opml.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="opml/"><?=_g('All feeds in OPML format')?></a> </p> </div> <div class="section"> <h2><?=_g('Syndicate')?></h2> <ul> - <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="atom.php"><?=_g('Feed (ATOM)')?></a></li> + <li><img src="custom/img/feed.png" alt="<?=_g('Feed')?>" height="12" width="12" /> <a href="feed/"><?=_g('Feed (ATOM)')?></a></li> </ul> </div> diff --git a/public/opml/index.php b/public/opml/index.php new file mode 100644 index 0000000..260057d --- /dev/null +++ b/public/opml/index.php @@ -0,0 +1,10 @@ +<?php +require_once '../../app/app.php'; + +if (!file_exists(config_path('people.opml'))) { + header('HTTP/1.1 404 Not Found'); + exit; +} + +header('Content-Type: text/xml; charset=utf-8'); +readfile(config_path('people.opml')); diff --git a/tests/InstallTest.php b/tests/InstallTest.php index 5433c56..212d5fe 100644 --- a/tests/InstallTest.php +++ b/tests/InstallTest.php @@ -100,4 +100,24 @@ class InstallTest extends GuzzleHarness $this->assertFileExists(custom_path('config.yml.bak'), "Backup config is kept"); $this->assertFileExists(custom_path('people.opml.bak'), "Backup OPML is kept"); } + + public function testFetchPublicOPML() + { + $data = [ + 'url' => 'http://127.0.0.1:8081/', + 'title' => 'My website', + 'password' => 'admin', + 'locale' => 'en', + ]; + + $res = $this->client->request('POST', '/install.php', [ + 'form_params' => $data + ]); + $this->assertEquals(200, $res->getStatusCode()); + $this->assertStringContainsString('Your moonmoon is ready.', (string) $res->getBody()); + + $res = $this->client->get('/opml/'); + $this->assertEquals(200, $res->getStatusCode()); + $this->assertXmlStringEqualsXmlFile(config_path('people.opml'), (string) $res->getBody()); + } } |