File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
tests/Integration/Http/Static Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,11 @@ public function deadLink(): string
5858 '<a href="https://google.com/404">foo</a> ' ,
5959 ]);
6060 }
61+
62+ #[Get('/static/allowed-dead-link ' )]
63+ #[StaticPage]
64+ public function allowedDeadLink (): string
65+ {
66+ return sprintf ('<a ssg-ignore href="%s">foo</a> ' , uri ('/404 ' ));
67+ }
6168}
Original file line number Diff line number Diff line change @@ -103,6 +103,18 @@ public function test_dead_link(): void
103103 ->assertExitCode (ExitCode::ERROR );
104104 }
105105
106+ public function test_allow_dead_links (): void
107+ {
108+ $ this ->registerRoute ([StaticPageController::class, 'deadLink ' ]);
109+ $ this ->registerStaticPage ([StaticPageController::class, 'deadLink ' ]);
110+
111+ $ this ->container ->config (new AppConfig (baseUri: 'https://test.com ' ));
112+
113+ $ this ->console
114+ ->call (StaticGenerateCommand::class, ['--allow-dead-links ' => true ])
115+ ->assertExitCode (ExitCode::SUCCESS );
116+ }
117+
106118 public function test_external_dead_links (): void
107119 {
108120 $ this ->registerRoute ([StaticPageController::class, 'deadLink ' ]);
@@ -117,4 +129,16 @@ public function test_external_dead_links(): void
117129 ->assertSee ('https://google.com/404 ' )
118130 ->assertExitCode (ExitCode::ERROR );
119131 }
132+
133+ public function test_ignore_dead_links (): void
134+ {
135+ $ this ->registerRoute ([StaticPageController::class, 'allowedDeadLink ' ]);
136+ $ this ->registerStaticPage ([StaticPageController::class, 'allowedDeadLink ' ]);
137+
138+ $ this ->container ->config (new AppConfig (baseUri: 'https://test.com ' ));
139+
140+ $ this ->console
141+ ->call (StaticGenerateCommand::class)
142+ ->assertExitCode (ExitCode::SUCCESS );
143+ }
120144}
You can’t perform that action at this time.
0 commit comments