diff --git a/localgov.install b/localgov.install index ee39b74..b78b971 100644 --- a/localgov.install +++ b/localgov.install @@ -6,6 +6,7 @@ */ use Drupal\user\Entity\User; +use Drupal\views\Entity\View; /** * Implements hook_install(). @@ -20,6 +21,18 @@ function localgov_install() { $user = User::load(1); $user->roles[] = 'administrator'; $user->save(); + + // Disable the frontpage view. + $frontpage_view = View::load('frontpage'); + $frontpage_view->setStatus(FALSE)->save(); + + // Set front page to /user. + // This is so there is a default accessible front page on first install. + \Drupal::configFactory() + ->getEditable('system.site') + ->set('page.front', '/user') + ->save(); + } /** diff --git a/tests/src/Functional/LocalGovProfileTest.php b/tests/src/Functional/LocalGovProfileTest.php index d1d3a4f..7b08d64 100644 --- a/tests/src/Functional/LocalGovProfileTest.php +++ b/tests/src/Functional/LocalGovProfileTest.php @@ -54,6 +54,10 @@ public function testLocalGovDrupalProfile() { $this->drupalLogin($adminUser); $this->drupalGet('admin'); $this->assertSession()->statusCodeEquals(Response::HTTP_OK); + + // Test that the /node view is disabled. + $this->drupalGet('/node'); + $this->assertSession()->statusCodeEquals(Response::HTTP_NOT_FOUND); } }