[koha-commits] main Koha release repository branch master updated. v16.11.00-467-gb6de109

Git repo owner gitmaster at git.koha-community.org
Fri Feb 17 16:40:16 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "main Koha release repository".

The branch, master has been updated
       via  b6de10944c768dcd80f85029c1a068d6b53a12f6 (commit)
       via  02f781fee06cb9ce8df8940acc2e8833cb57644b (commit)
       via  39d090a8b6ecb2c97197f839a05c930a36ea6504 (commit)
       via  51f62ccb302e02b04ca608d382ce343ffd18726e (commit)
      from  a3d2273b3516129eab774e95841a5cb61c8e4580 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b6de10944c768dcd80f85029c1a068d6b53a12f6
Author: Tomas Cohen Arazi <tomascohen at theke.io>
Date:   Tue Jan 24 10:48:31 2017 -0300

    Bug 17932: (followup) Tidy tests
    
    This patch makes the tests create its own data instead of searching the
    DB for a branchcode and a categorycode. It does so on each subtest,
    because there shouldn't be side effects between subtests.
    
    I also wrapped each subtest inside a transaction, for the same reason.
    
    To test:
    - Apply this patch
    - Run:
      $ prove t/db_dependent/Koha/Object.t
    => SUCCESS: Tests return green with this patch
    - Sign off :-D
    
    Signed-off-by: Nick Clemens <nick at bywatersolutions.com>
    Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
    
    Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

commit 02f781fee06cb9ce8df8940acc2e8833cb57644b
Author: Tomas Cohen Arazi <tomascohen at theke.io>
Date:   Tue Jan 24 10:41:00 2017 -0300

    Bug 17932: Unit tests
    
    This patch adds unit tests for the Koha::Object::TO_JSON function.
    It tests on top of Koha::Patron as Koha::Object needs to be
    instantiated.
    
    To test:
    - Apply the patch
    - Run:
      $ prove -v t/db_dependent/Koha/Object.t
    => SUCCESS: New tests for TO_JSON are run and return green.
    - Sign off :-D
    
    Signed-off-by: Nick Clemens <nick at bywatersolutions.com>
    Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
    
    Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

commit 39d090a8b6ecb2c97197f839a05c930a36ea6504
Author: Tomas Cohen Arazi <tomascohen at theke.io>
Date:   Mon Jan 23 09:47:54 2017 -0300

    Bug 17932: (followup) Fix /patrons endpoint
    
    Bug 17927 introduced data type fixes on the /patrons endpoint (integer
    and boolean types got fixed). This led to the /patrons endpoint not to
    work because the underlying code didn't provide the right data.
    
    With the introduction of TO_JSON on Koha::Object(s) we now have a way to
    output the proper data types.
    
    This patch does so by:
    - Adding is_boolean => 1 to the relevant columns on the Borrower.pm
      schema file.
    - Tweaking the controller class for the /patrons endpoint so it doesn't
      use the $object(s)->unblessed call but just let the Mojo::JSON library
      pick out TO_JSON implementation instead on rendering the output.
    - It adds a new test for booleans.
    
    To test:
    - Have 17927 applied
    - Run:
      $ prove t/db_dependent/api/v1/patrons.t
    => FAIL: Tests fail [1]
    - Apply this patches
    - Run:
      $ prove t/db_dependent/api/v1/patrons.t
    => SUCCESS: Tests pass!
    - Sign off! :-D
    
    [1] It is self explanatory to just try the API using any of the
    available tools (I use HttpRequester on Firefox)
    
    Signed-off-by: Nick Clemens <nick at bywatersolutions.com>
    Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
    
    Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

commit 51f62ccb302e02b04ca608d382ce343ffd18726e
Author: Tomas Cohen Arazi <tomascohen at theke.io>
Date:   Wed Jan 18 15:37:42 2017 -0300

    Bug 17932: Add a TO_JSON method to Koha::Object(s)
    
    Bug 17927 fixes data types on the current REST endpoints. If you
    test those endpoints, you will notice trying to access them (for listing
    or retrieving single objects yields a data type error. Notably on
    booleans but also on integers.
    
    Integers fail due to https://rt.cpan.org/Ticket/Display.html?id=119904
    but it needs some global solution until there's a DBD::mysql release
    backported to the supported distros. There's the option to use
    http://search.cpan.org/~frew/DBIx-Class-Helpers-2.033002/lib/DBIx/Class/Helper/Row/NumifyGet.pm
    to get the integer columns fixed as a workaround:
    
     __PACKAGE__->add_columns(
        borrowernumber => {
            data_type         => 'integer',
            is_nullable       => 0,
            is_numeric        => 1,
        }
    );
    
    I didn't find bug reports related to this (maybe because we don't use
    warnings everywhere) But I don't think is worth going such a heavy
    overhead.
    
    A similar situation takes place for Boolean values. They need to be
    prepared for JSON output. This could have been done using DBIx filters
    as pointed out by Martin:
    
    __PACKAGE__->filter_column(
        lost => {
           filter_to_storage => sub { $_[1] ? 1 : 0 },
           filter_from_storage =>
                   sub { $_[1] ? Mojo::JSON->true :
                                 Mojo::JSON->false }
           }
    );
    
    but this could have other consequences that are worth exploring on
    another bug (i.e. it would mean we need to take care of every place
    where this boolean data is used/set needs to handle this data types
    nicely. Such would be the case if we were a Mojo-only app, but we
    aren't. We use Koha::Obect(s) in the whole app. Period.
    
    This patch adds the need to specify on the schema files, columns that
    are actually boolean, because we have no way to detect them for now
    (i.e. they are all tinyint, but we use tinyint for non-boolean stuff
     too).
    So if this patch is accepted, we would need to specify boolean columns
    like this:
    
    __PACKAGE__->add_columns(
        '+lost' => {
            is_boolean => 1
        }
    );
    
    This patch adds a TO_JSON method for Koha::Object(s) to be used for
    serializing Koha::Object-derived objects into JSON strings.
    
    To test it (as Koha::Object(s) need to be instantiated) I provide tests
    on top of the Koha::Patron(s) classes in the followup patches.
    
    [1] Yes, we use TINYINT(1) for booleans, but from DBIC's perspective
    there's no way to read the (1) in runtime.
    
    Sponsored-by: ByWater Solutions
    
    Signed-off-by: Nick Clemens <nick at bywatersolutions.com>
    Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
    
    Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

-----------------------------------------------------------------------

Summary of changes:
 Koha/Object.pm                  |   56 ++++++++++++++++++++++++++++
 Koha/Objects.pm                 |   12 ++++++
 Koha/REST/V1/Patron.pm          |    4 +-
 Koha/Schema/Result/Borrower.pm  |    5 +++
 t/db_dependent/Koha/Object.t    |   77 +++++++++++++++++++++++++++++++++++----
 t/db_dependent/api/v1/patrons.t |    8 ++--
 6 files changed, 150 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
main Koha release repository


More information about the koha-commits mailing list