Bug 16331 - TestBuilder does not allow undef/NULL values
Summary: TestBuilder does not allow undef/NULL values
Status: RESOLVED DUPLICATE of bug 16155
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-25 09:04 UTC by Jonathan Druart
Modified: 2016-05-04 14:56 UTC (History)
3 users (show)

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


Attachments
Bug 16331: TestBuilder - Allow undef/NULL as a valid value (2.04 KB, patch)
2016-04-25 09:07 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2016-04-25 09:04:49 UTC
When building new entities with TestBuilder, sometimes we would like to assign undef to a value.
Comment 1 Jonathan Druart 2016-04-25 09:07:47 UTC
Created attachment 50614 [details] [review]
Bug 16331: TestBuilder - Allow undef/NULL as a valid value

When building new entities with TestBuilder, sometimes we would like to
assign undef to a value.
See bug 16276 patch 4 - Change to GetBorrowersToExpunge to take
last_seen into account for a use case.

Test plan:
Confirm that the TestBuilder tests still pass
Comment 2 Mark Tompsett 2016-04-26 00:24:05 UTC
prove t/db_dependent/TestBuilder.t doesn't pass in master before patch. This makes testing hard.
Comment 3 Chris Cormack 2016-04-26 08:47:53 UTC
Yep 

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/TestBuilder.t 
t/db_dependent/TestBuilder.t .. 3/41 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) [for Statement "DELETE FROM `aqbasket` WHERE ( `basketno` = ? )" with ParamValues: 0='17'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
DBIx::Class::Storage::DBI::_dbh_execute(): Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) at /home/vagrant/kohaclone/t/lib/TestBuilder.pm line 92
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /usr/share/perl5/DBIx/Class/Exception.pm line 77

Can't really test (fails before patch)
Comment 4 Marcel de Rooy 2016-04-26 09:54:38 UTC
Jonathan: Please check bug 16155. It already includes this point and more.
Comment 5 Jonathan Druart 2016-04-26 15:27:11 UTC
(In reply to M. Tompsett from comment #2)
> prove t/db_dependent/TestBuilder.t doesn't pass in master before patch. This
> makes testing hard.

I have let a comment on bug 15630.
To make them pass, you can remove the 3 FK on the edifact_messages table.
Comment 6 Jonathan Druart 2016-04-26 15:28:56 UTC
(In reply to Marcel de Rooy from comment #4)
> Jonathan: Please check bug 16155. It already includes this point and more.

I needed a quick solution to build my tests, and this is a 2 lines patch.
Comment 7 Jonathan Druart 2016-05-04 14:56:37 UTC
(In reply to Marcel de Rooy from comment #4)
> Jonathan: Please check bug 16155. It already includes this point and more.

Bug 16155 is pushed to master. I confirm that it fixes this bug.
Comment 8 Jonathan Druart 2016-05-04 14:56:54 UTC

*** This bug has been marked as a duplicate of bug 16155 ***