summaryrefslogtreecommitdiffstats
path: root/common/tests/InstallTest.php
diff options
context:
space:
mode:
authorNicolas Lécureuil <neoclust@mageia.org>2020-05-17 14:46:00 +0200
committerNicolas Lécureuil <neoclust@mageia.org>2020-05-17 14:46:00 +0200
commite3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa (patch)
tree336981502f93ceb9fa5ed33ea3b47dcefc5a8402 /common/tests/InstallTest.php
parentff32e499745367b816d10f25e63ff3328214c32f (diff)
downloadplanet-e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa.tar
planet-e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa.tar.gz
planet-e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa.tar.bz2
planet-e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa.tar.xz
planet-e3de9d7dd1331f9718e04cc98e9ca7cfa27cf4aa.zip
Sync with master of moonmoon ( version 9.0.0-rc)HEADuser/wally/upstream-10-devmaster
Source from https://github.com/Emmafrs/moonmoon/
Diffstat (limited to 'common/tests/InstallTest.php')
-rw-r--r--common/tests/InstallTest.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/common/tests/InstallTest.php b/common/tests/InstallTest.php
new file mode 100644
index 0000000..7615f18
--- /dev/null
+++ b/common/tests/InstallTest.php
@@ -0,0 +1,61 @@
+<?php
+
+require_once 'GuzzleHarness.php';
+
+class InstallTest extends GuzzleHarness {
+
+ public function setUp()
+ {
+ parent::setUp();
+ removeCustomFiles();
+ }
+
+ public function tearDown()
+ {
+ parent::tearDown();
+ removeCustomFiles();
+ }
+
+ public function test_index_page_tells_moonmoon_is_not_installed()
+ {
+ $res = $this->client->get('/index.php');
+ $this->assertEquals(200, $res->getStatusCode());
+ $this->assertContains('install moonmoon', (string) $res->getBody());
+ }
+
+ public function test_install_page_loads_without_error()
+ {
+ $res = $this->client->get('/install.php');
+ $this->assertEquals(200, $res->getStatusCode());
+ $this->assertContains('Administrator password', (string) $res->getBody());
+ }
+
+ /**
+ * Regression test, `people.opml` was created by requesting `/install.php`
+ * even if the site was not installed: `touch()` was called to see if
+ * the path was writable but the file was not removed.
+ */
+ public function test_get_install_page_should_not_create_custom_files()
+ {
+ $this->client->get('/install.php');
+ $this->assertFalse(file_exists(custom_path('people.opml')));
+ $this->assertFalse(file_exists(custom_path('config.yml')));
+ $this->assertFalse(file_exists(custom_path('inc/pwc.inc.php')));
+ }
+
+ public function test_install_button()
+ {
+ $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->assertContains('Your moonmoon is ready.', (string) $res->getBody());
+ }
+} \ No newline at end of file