layoutSource = (string) file_get_contents($path); self::assertNotEmpty($this->layoutSource); } #[Test] public function htmlRootCarriesLangAttribute(): void { // The layout emits with the value rendered by PHP from // the $locale variable (not literally `$locale` between quotes). // We assert the source binds lang to the $locale variable inside PHP output. self::assertStringContainsString('layoutSource); self::assertStringContainsString('href="#main"', $this->layoutSource); } #[Test] public function mainLandmarkHasIdAndAriaLabel(): void { self::assertMatchesRegularExpression( '/]*\bid="main"/', $this->layoutSource ); self::assertMatchesRegularExpression( '/]*\baria-label=/', $this->layoutSource ); } #[Test] public function navLandmarkHasAriaLabel(): void { self::assertMatchesRegularExpression( '/]*\baria-label=/', $this->layoutSource ); } #[Test] public function footerHasRoleAndLabel(): void { self::assertMatchesRegularExpression( '/]*\baria-label=/', $this->layoutSource ); } #[Test] public function lightboxIsADialogModal(): void { self::assertStringContainsString('id="lightbox"', $this->layoutSource); self::assertStringContainsString('role="dialog"', $this->layoutSource); self::assertStringContainsString('aria-modal="true"', $this->layoutSource); } #[Test] public function lightboxImageCarriesAltAttribute(): void { self::assertMatchesRegularExpression( '/]*\bid="lightboxImg"[^>]*\balt=/', $this->layoutSource ); } #[Test] public function localeSwitcherHostIsAriaLabeled(): void { // The LocaleSwitcher widget uses aria-label on its
    . self::assertStringContainsString('aria-label="', $this->layoutSource); } #[Test] public function mobileNavToggleIsKeyboardAccessible(): void { self::assertMatchesRegularExpression( '/]*\bclass="nav-hamburger"/', $this->layoutSource ); self::assertStringContainsString('aria-expanded=', $this->layoutSource); self::assertStringContainsString('aria-controls=', $this->layoutSource); } }