diff -u b/src/EventSubscriber/Fast404EventSubscriber.php b/src/EventSubscriber/Fast404EventSubscriber.php --- b/src/EventSubscriber/Fast404EventSubscriber.php +++ b/src/EventSubscriber/Fast404EventSubscriber.php @@ -27,7 +27,7 @@ public $requestStack; /** - * The language mananger + * The language manager. * * @var \Drupal\Core\Language\LanguageManagerInterface */ diff -u b/src/Fast404.php b/src/Fast404.php --- b/src/Fast404.php +++ b/src/Fast404.php @@ -41,7 +41,7 @@ public $loadHtml = TRUE; /** - * The langcode, this will help us to load the translated 404 page if it exists. + * The langcode to use for the translated 404 page if it exists. * * @var string */ @@ -213,13 +213,15 @@ // If a file is set to provide us with Fast 404 joy, load it. if (($this->loadHtml || Settings::get('fast404_HTML_error_all_paths', FALSE) === TRUE)) { if (is_array($custom_404)) { - // If it is an array, get path depending on the langcode, if langcode is NULL, default to the first value. + // If it is an array, get path depending on the langcode; + // if langcode is NULL, default to the first value. $custom_404_path = $this->langcode && isset($custom_404[$this->langcode]) ? $custom_404[$this->langcode] : reset($custom_404); - } else { + } + else { $custom_404_path = $custom_404; } - if(file_exists($custom_404_path)) { + if (file_exists($custom_404_path)) { $message = @file_get_contents($custom_404_path, FALSE); } } diff -u b/tests/html/en.html b/tests/html/en.html --- b/tests/html/en.html +++ b/tests/html/en.html @@ -8,7 +8,7 @@

- Custom Page not found + Custom Page Not Found

diff -u b/tests/src/Functional/Fast404HtmlPageTest.php b/tests/src/Functional/Fast404HtmlPageTest.php --- b/tests/src/Functional/Fast404HtmlPageTest.php +++ b/tests/src/Functional/Fast404HtmlPageTest.php @@ -37,7 +37,7 @@ * Tests the html page functionality. */ public function testHtmlPage() { - // Let fast404 subscribe to NotFoundHttpException + // Let fast404 subscribe to NotFoundHttpException. $settings['settings']['fast404_not_found_exception'] = (object) [ 'value' => TRUE, 'required' => TRUE, @@ -51,10 +51,10 @@ $this->writeSettings($settings); - // Try to access a non-existant page. + // Try to access a non-existent page. $this->drupalGet('/unknown-page'); $this->assertSession()->statusCodeEquals(404); - $this->assertSession()->pageTextContains('Custom Page not found'); + $this->assertSession()->pageTextContains('Custom Page Not Found'); // Setup html page with translation. $settings['settings']['fast404_HTML_error_page'] = (object) [ @@ -69,12 +69,14 @@ - // Try to access a non-existant page. + // Try to access a non-existent page. $this->drupalGet('/unknown-page-en'); $this->assertSession()->statusCodeEquals(404); - $this->assertSession()->pageTextContains('Custom Page not found'); + $this->assertSession()->pageTextContains('Custom Page Not Found'); - // Try to access a non-existant page. + // Try to access a non-existent page. $this->drupalGet('/fr/unknown-page-fr'); $this->assertSession()->statusCodeEquals(404); $this->assertSession()->pageTextContains('Page personnalisée introuvable'); + } + }