(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestWithRequestSplitPath(t *testing.T) { |
| 11 | t.Parallel() |
| 12 | |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | splitPath []string |
| 16 | wantErr error |
| 17 | wantSplitPath []string |
| 18 | }{ |
| 19 | { |
| 20 | name: "valid lowercase split path", |
| 21 | splitPath: []string{".php"}, |
| 22 | wantErr: nil, |
| 23 | wantSplitPath: []string{".php"}, |
| 24 | }, |
| 25 | { |
| 26 | name: "valid uppercase split path normalized", |
| 27 | splitPath: []string{".PHP"}, |
| 28 | wantErr: nil, |
| 29 | wantSplitPath: []string{".php"}, |
| 30 | }, |
| 31 | { |
| 32 | name: "valid mixed case split path normalized", |
| 33 | splitPath: []string{".PhP", ".PHTML"}, |
| 34 | wantErr: nil, |
| 35 | wantSplitPath: []string{".php", ".phtml"}, |
| 36 | }, |
| 37 | { |
| 38 | name: "empty split path", |
| 39 | splitPath: []string{}, |
| 40 | wantErr: nil, |
| 41 | wantSplitPath: []string{}, |
| 42 | }, |
| 43 | { |
| 44 | name: "non-ASCII character in split path rejected", |
| 45 | splitPath: []string{".php", ".Ⱥphp"}, |
| 46 | wantErr: ErrInvalidSplitPath, |
| 47 | }, |
| 48 | { |
| 49 | name: "unicode character in split path rejected", |
| 50 | splitPath: []string{".phpⱥ"}, |
| 51 | wantErr: ErrInvalidSplitPath, |
| 52 | }, |
| 53 | } |
| 54 | |
| 55 | for _, tt := range tests { |
| 56 | t.Run(tt.name, func(t *testing.T) { |
| 57 | t.Parallel() |
| 58 | |
| 59 | ctx := &frankenPHPContext{} |
| 60 | opt, err := WithRequestSplitPath(tt.splitPath) |
| 61 | |
| 62 | if tt.wantErr != nil { |
| 63 | require.ErrorIs(t, err, tt.wantErr) |
| 64 | |
| 65 | return |
| 66 | } |
| 67 |
nothing calls this directly
no test coverage detected