MCPcopy
hub / github.com/caddyserver/caddy / TestPHPFileMatcher

Function TestPHPFileMatcher

modules/caddyhttp/fileserver/matcher_test.go:291–402  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

289}
290
291func TestPHPFileMatcher(t *testing.T) {
292 for i, tc := range []struct {
293 path string
294 expectedPath string
295 expectedType string
296 matched bool
297 }{
298 {
299 path: "/index.php",
300 expectedPath: "/index.php",
301 expectedType: "file",
302 matched: true,
303 },
304 {
305 path: "/index.php/somewhere",
306 expectedPath: "/index.php",
307 expectedType: "file",
308 matched: true,
309 },
310 {
311 path: "/remote.php",
312 expectedPath: "/remote.php",
313 expectedType: "file",
314 matched: true,
315 },
316 {
317 path: "/remote.php/somewhere",
318 expectedPath: "/remote.php",
319 expectedType: "file",
320 matched: true,
321 },
322 {
323 path: "/missingfile.php",
324 matched: false,
325 },
326 {
327 path: "/notphp.php.txt",
328 expectedPath: "/notphp.php.txt",
329 expectedType: "file",
330 matched: true,
331 },
332 {
333 path: "/notphp.php.txt/",
334 expectedPath: "/notphp.php.txt",
335 expectedType: "file",
336 matched: true,
337 },
338 {
339 path: "/notphp.php.txt.suffixed",
340 matched: false,
341 },
342 {
343 path: "/foo.php.php/index.php",
344 expectedPath: "/foo.php.php/index.php",
345 expectedType: "file",
346 matched: true,
347 },
348 {

Callers

nothing calls this directly

Calls 3

MatchWithErrorMethod · 0.95
NewTestReplacerFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected