| Summary: | TestBuilder should explode if FK broken | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Component: | Architecture, internals, and plumbing | Assignee: | Bugs List <koha-bugs> |
| Status: | NEW --- | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | jonathan.druart, kyle, martin.renvoize, tomascohen |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
Sounds sensible to me IIRC we decided that on purpose, so the test does not fail if the DB had the data before running the tests. But yes, I agree we could change the behaviour and explode instead. In your example we do not care about the branchcode, we should build a library with a random branchcode and reuse it later. |
Right now, it only warns and continues. While this might mean 'there already exists a resource with the value we need for the test', this is really hiding a design issue with the tests. For example ```perl my $library = $builde->build_object( { class => 'Koha::Libraries, value => { branchcode => 'ILL', pickup_location => 1 } } ); ``` might fail because 'ILL' already exists, but if the DB entry doesn't contain the other fixed condition (pickup_location=1) then the tests could fail weirdly, and tracking it would be harder (i.e. you read the code, see you are setting pickup_location=1, but it fails because it is not). I propose we make it explode loudly instead. And fix the poorly written tests that explode because of it.