From 4f16dc14b0396e411c49be02eb5a8a7609ec78f6 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Tue, 6 Oct 2026 03:22:49 -0500 Subject: [PATCH] Give the missing-image test a language string The unconfigured language mock returned null, so DOMDocument::createTextNode() raised a deprecation notice in every test run. The mock now returns the language key, and the test checks the notice text. Co-Authored-By: Claude Opus 5.5 --- tests/controller/documentation_helper_test.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/controller/documentation_helper_test.php b/tests/controller/documentation_helper_test.php index 221aae1..c93f652 100644 --- a/tests/controller/documentation_helper_test.php +++ b/tests/controller/documentation_helper_test.php @@ -306,11 +306,16 @@ public function test_missing_image_preserves_its_alt_description() file_put_contents($this->docs_root . '/en/quickstart/index.html', '
A "quoted" <diagram>
'); - $result = $this->get_helper()->resolve_and_load('en', 'quickstart'); + $language = $this->createMock(language::class); + $language->method('lang')->willReturnArgument(0); + $helper = new documentation_helper($this->get_config(), $language, $this->get_request(), + $this->get_user(), '', $this->get_controller_helper()); + $result = $helper->resolve_and_load('en', 'quickstart'); $dom = new \DOMDocument(); @$dom->loadHTML($result['article_html']); $notices = (new \DOMXPath($dom))->query('//span[@class="documentation-image-missing"]'); $this->assertCount(2, $notices); + $this->assertSame('DOCUMENTATION_IMAGE_MISSING', $notices->item(0)->textContent); $this->assertSame('A "quoted" ', $notices->item(0)->getAttribute('data-doc-tooltip')); $this->assertSame('0', $notices->item(0)->getAttribute('tabindex')); $this->assertFalse($notices->item(1)->hasAttribute('data-doc-tooltip'));