Bugzilla – Attachment 29884 Details for
Bug 10212
Columns configuration for tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10212: Columns configuration for tables - Unit tests
PASSED-QA-Bug-10212-Columns-configuration-for-tabl.patch (text/plain), 7.29 KB, created by
Katrin Fischer
on 2014-07-20 19:56:38 UTC
(
hide
)
Description:
[PASSED QA] Bug 10212: Columns configuration for tables - Unit tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-07-20 19:56:38 UTC
Size:
7.29 KB
patch
obsolete
>From 37733059c25115a918be4fa62d76e4521b09fcec Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 10 Jan 2014 18:26:27 +0100 >Subject: [PATCH] [PASSED QA] Bug 10212: Columns configuration for tables - > Unit tests > >test plan: >Verify the > prove t/db_dependent/ColumnsSettings.t >returns green. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > admin/columns_settings.yml | 23 +++-- > t/db_dependent/ColumnsSettings.t | 179 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 197 insertions(+), 5 deletions(-) > create mode 100644 t/db_dependent/ColumnsSettings.t > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 91d69f4..9e9a49c 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -1,10 +1,23 @@ > modules: >- module_name: >- page_name: >- table_id: >+ admin: >+ currency: >+ currencies-table: > - >- columnname: my_column_name >+ columnname: currency >+ cannot_be_toggled: 1 >+ cannot_be_modified: 1 > - >- columnname: my_other_column_name >+ columnname: rate > cannot_be_toggled: 1 > cannot_be_modified: 1 >+ - >+ columnname: symbol >+ - >+ columnname: iso_code >+ is_hidden: 1 >+ - >+ columnname: last_updated >+ - >+ columnname: active >+ - >+ columnname: actions >diff --git a/t/db_dependent/ColumnsSettings.t b/t/db_dependent/ColumnsSettings.t >new file mode 100644 >index 0000000..460d547 >--- /dev/null >+++ b/t/db_dependent/ColumnsSettings.t >@@ -0,0 +1,179 @@ >+#!/usr/bin/perl; >+ >+use Modern::Perl; >+use Test::More tests => 2; >+use Test::MockModule; >+ >+use C4::Context; >+use C4::Utils::DataTables::ColumnsSettings; >+my $dbh = C4::Context->dbh; >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+$dbh->do(q|DELETE FROM columns_settings|); >+ >+my $module = new Test::MockModule('C4::Utils::DataTables::ColumnsSettings'); >+$module->mock( >+ 'get_yaml', >+ sub { >+ { >+ modules => { >+ admin => { >+ currency => { >+ 'currencies-table' => [ >+ { >+ columnname => 'currency', >+ cannot_be_toggled => '1', >+ cannot_be_modified => '1' >+ }, >+ { >+ columnname => 'rate', >+ cannot_be_toggled => '1', >+ cannot_be_modified => '1' >+ }, >+ { >+ columnname => 'symbol' >+ }, >+ { >+ is_hidden => '1', >+ columnname => 'iso_code' >+ }, >+ { >+ columnname => 'last_updated' >+ }, >+ { >+ columnname => 'active' >+ }, >+ { >+ columnname => 'actions' >+ } >+ ] >+ } >+ } >+ } >+ >+ }; >+ } >+); >+ >+C4::Utils::DataTables::ColumnsSettings::update_columns( >+ { >+ columns => [ >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'currency', >+ cannot_be_toggled => 1, >+ cannot_be_modified => 1, >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'rate', >+ cannot_be_toggled => 1, >+ cannot_be_modified => 1, >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'symbol', >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'iso_code', >+ is_hidden => 0, >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'last_updated', >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'active', >+ is_hidden => 1, >+ }, >+ { >+ module => 'admin', >+ page => 'currency', >+ tablename => 'currencies-table', >+ columnname => 'actions', >+ cannot_be_toggled => 1, >+ }, >+ ] >+ } >+); >+ >+my $modules = C4::Utils::DataTables::ColumnsSettings::get_modules(); >+ >+my $modules_expected = { >+ 'admin' => { >+ 'currency' => { >+ 'currencies-table' => [ >+ { >+ columnname => 'currency', >+ cannot_be_toggled => 1, >+ cannot_be_modified => 1, >+ is_hidden => 0, >+ }, >+ { >+ columnname => 'rate', >+ cannot_be_toggled => 1, >+ cannot_be_modified => 1, >+ is_hidden => 0, >+ }, >+ { >+ columnname => 'symbol', >+ cannot_be_toggled => 0, >+ is_hidden => 0, >+ }, >+ { >+ columnname => 'iso_code', >+ cannot_be_toggled => 0, >+ is_hidden => 0, >+ }, >+ { >+ columnname => 'last_updated', >+ cannot_be_toggled => 0, >+ is_hidden => 0, >+ }, >+ { >+ columnname => 'active', >+ cannot_be_toggled => 0, >+ is_hidden => 1, >+ }, >+ { >+ columnname => 'actions', >+ cannot_be_toggled => 1, >+ is_hidden => 0, >+ }, >+ ] >+ } >+ } >+}; >+ >+is_deeply( $modules, $modules_expected, 'get_modules returns all values' ); >+ >+for my $m ( keys %$modules ) { >+ for my $p ( keys %{ $modules->{$m} } ) { >+ for my $t ( keys %{ $modules->{$m}{$p} } ) { >+ my $columns = >+ C4::Utils::DataTables::ColumnsSettings::get_columns( $m, $p, $t ); >+ is_deeply( >+ $columns, >+ $modules->{$m}{$p}{$t}, >+ "columns for $m>$p>$t" >+ ); >+ } >+ } >+} >+ >+$dbh->rollback; >-- >1.9.1
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 10212
:
17978
|
17979
|
18861
|
20625
|
20640
|
21178
|
21179
|
21180
|
21583
|
21584
|
21585
|
24083
|
24084
|
24085
|
24149
|
24150
|
24151
|
24167
|
24168
|
24577
|
27700
|
27701
|
27702
|
27703
|
27704
|
27705
|
29075
|
29076
|
29077
|
29078
|
29079
|
29080
|
29537
|
29538
|
29539
|
29540
|
29541
|
29701
|
29702
|
29703
|
29704
|
29705
|
29718
|
29830
|
29836
|
29837
|
29838
|
29839
|
29840
|
29841
|
29842
|
29882
|
29883
| 29884 |
29885
|
29886
|
29887
|
29888
|
29947
|
31158
|
31159