Bug 39741 - xt/author/valid-templates.t should setting dirs to skip
Summary: xt/author/valid-templates.t should setting dirs to skip
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on: 38340
Blocks:
  Show dependency treegraph
 
Reported: 2025-04-24 14:21 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-04-25 22:15 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39741: Make valid-templates.t handle dirs (3.10 KB, patch)
2025-04-24 14:49 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 39741: Make valid-templates.t handle dirs (3.15 KB, patch)
2025-04-25 22:12 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2025-04-24 14:21:14 UTC
Bug 38340 added a bunch of form includes that all live in the same dir, to the exclusion list.

We should refactor those tests so one can set a directory for exclusion instead of listing each file.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-04-24 14:49:27 UTC
Created attachment 181462 [details] [review]
Bug 39741: Make valid-templates.t handle dirs

This patch changes the regex so it doesn't expect the exclusion
parameters to only be files but accept directories too.

The risk of this is we might at some point catch more than we want.

I don't think it is worth spending more time in it, though.

To test:
1. Run:
   $ ktd --shell
  k$ prove xt/author/valid-templates.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass! We don't need to list each individual file
anymore and it will still work!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2025-04-24 14:50:24 UTC
Another option could be to properly refactor the parameters so the exclusion lists are two: files and dirs. And each use a different regex.

I leave my 2 cents here.
Comment 3 David Nind 2025-04-25 22:12:47 UTC
Created attachment 181559 [details] [review]
Bug 39741: Make valid-templates.t handle dirs

This patch changes the regex so it doesn't expect the exclusion
parameters to only be files but accept directories too.

The risk of this is we might at some point catch more than we want.

I don't think it is worth spending more time in it, though.

To test:
1. Run:
   $ ktd --shell
  k$ prove xt/author/valid-templates.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass! We don't need to list each individual file
anymore and it will still work!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-04-25 22:15:54 UTC
Testing notes (using KTD):
1. Tests pass before and after the patch.
2. Getting lots of output with these lines - not sure whether this is a good or bad thing:
   - Argument "" isn't numeric in numeric gt (>)...
   - # excluding template /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc because it cannot stand on its own