Bugzilla – Attachment 49634 Details for
Bug 16155
Composite keys in TestBuilder and more
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16155: [DO_NOT_PUSH] OldBehavior.t
Bug-16155-DONOTPUSH-OldBehaviort.patch (text/plain), 3.29 KB, created by
Marcel de Rooy
on 2016-03-29 14:23:40 UTC
(
hide
)
Description:
Bug 16155: [DO_NOT_PUSH] OldBehavior.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-03-29 14:23:40 UTC
Size:
3.29 KB
patch
obsolete
>From 4344ad4a94a5b7b8dc356659903888a08e9f4072 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 29 Mar 2016 14:57:27 +0200 >Subject: [PATCH] Bug 16155: [DO_NOT_PUSH] OldBehavior.t >Content-Type: text/plain; charset=utf-8 > >This test just serves to illustrate the points mentioned in the commit >message of the second patch. > >Test plan: >Run this test before applying patch 2. >See also commit message of the next patch. >--- > OldBehavior.t | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 87 insertions(+) > create mode 100644 OldBehavior.t > >diff --git a/OldBehavior.t b/OldBehavior.t >new file mode 100644 >index 0000000..26a7835 >--- /dev/null >+++ b/OldBehavior.t >@@ -0,0 +1,87 @@ >+use Modern::Perl; >+use Test::More; >+use Test::Warn; >+use Data::Dumper qw(Dumper); >+ >+use Koha::Database; >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+my $builder = t::lib::TestBuilder->new(); >+ >+# Goal 1 >+my $borrower = $builder->build({ source => 'Borrower' }); >+my $userperm = $builder->build({ >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $borrower->{borrowernumber}, >+ module_bit => { flag => 'my_flag' }, >+ code => 'does_not_exist', >+ }, >+ }); >+isnt( $userperm->{code}, 'does_not_exist', >+ "code $userperm->{code} was inserted" ); >+eval { $builder->build({ >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $borrower->{borrowernumber}, >+ module_bit => 10, >+ code => { code => 'new code' }, >+ }, >+ }); }; >+is( $@ =~ /You have an error in your SQL syntax/, 1, 'Stumbled over hash'); >+ >+#Goal 2 >+eval { $builder->build({ >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $borrower->{borrowernumber}, >+ module_bit => 99, >+ code => 'new_super_tool', >+ }, >+ }); }; >+is( $@ =~ /Cannot add or update a child row/, 1, 'Stumbled over FK'); >+ >+#Goal 3 >+if( !$builder->schema->resultset('Branch')->find('CPL') ) { >+ $builder->schema->resultset('Branch')->create({ >+ branchcode => 'CPL', branchname => 'My branch', >+ }); >+} >+my $branch = $builder->build({ >+ source => 'Branch', >+ value => { branchcode => 'CPL' }, >+}); >+is( $branch && $branch->{branchname} ne 'My branch', 1, >+ "Branch name changed" ); >+ >+#Goal 4 >+my $patron = $builder->build({ >+ source => 'Borrower', >+ value => { borrowernumber => '123456789' }, >+}); >+is( $patron->{borrowernumber}, 123456789, 'auto incr not respected' ); >+ >+#Goal 5 >+if( !$builder->schema->resultset('Branch')->find('MPL') ) { >+ $builder->schema->resultset('Branch')->create({ >+ branchcode => 'MPL', branchname => 'My branch', >+ }); >+} >+my $item = $builder->build({ >+ source => 'Item', >+ value => { homebranch => { branchcode => 'MPL' } }, >+}); >+my $newname = $builder->schema->resultset('Branch')->find('MPL')->branchname; >+isnt( $newname, 'My branch', "Branch name changed to $newname" ); >+ >+#Goal 6 >+my $reserve = $builder->build({ >+ source => 'Reserve', >+ value => { itemnumber => undef }, >+ }); >+isnt( $reserve->{itemnumber}, undef, >+ "Itemnumber $reserve->{itemnumber} is not undef" ); >+ >+done_testing(); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16155
: 49634 |
49635
|
49636
|
49637
|
49638
|
50490
|
50491
|
50492
|
50493
|
50494
|
50518
|
50525
|
50526
|
50527
|
50528
|
50529
|
50530