Marcel de Rooy
074428bb8a
Since new_from_dbic is not meant as a public method, this patch adds a prefix to the name of this internal routine. For the same reason I removed it from t/Borrower.t. Removed one use overload-line in Objects (not used). Resolved a few typos. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
56 lines
2 KiB
Perl
Executable file
56 lines
2 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use Test::More tests => 13;
|
|
use Test::Warn;
|
|
|
|
use Koha::Database;
|
|
|
|
BEGIN {
|
|
use_ok('Koha::Object');
|
|
use_ok('Koha::Borrower');
|
|
}
|
|
|
|
my $object = Koha::Borrower->new( { surname => 'Test Borrower' } );
|
|
|
|
is( $object->surname(), 'Test Borrower', "Accessor returns correct value" );
|
|
|
|
$object->surname('Test Borrower Surname');
|
|
is( $object->surname(), 'Test Borrower Surname', "Accessor returns correct value after set" );
|
|
|
|
my $object2 = Koha::Borrower->new( { surname => 'Test Borrower 2' } );
|
|
is( $object2->surname(), 'Test Borrower 2', "Accessor returns correct value" );
|
|
|
|
$object2->surname('Test Borrower Surname 2');
|
|
is( $object2->surname(), 'Test Borrower Surname 2', "Accessor returns correct value after set" );
|
|
|
|
my $ret;
|
|
$ret = $object2->set({ surname => "Test Borrower Surname 3", firstname => "Test Firstname" });
|
|
is( $ret, 1, "Set returns 1 on success" );
|
|
is( $object2->surname(), "Test Borrower Surname 3", "Set sets first field correctly" );
|
|
is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" );
|
|
|
|
$ret = $object->set({ surname => "Test Borrower Surname 4", bork => "bork" });
|
|
is( $object2->surname(), "Test Borrower Surname 3", "Bad Set does not set field" );
|
|
is( $ret, 0, "Set returns 0 when passed a bad property" );
|
|
|
|
ok( ! defined $object->bork(), 'Bad getter returns undef' );
|
|
ok( ! defined $object->bork('bork'), 'Bad setter returns undef' );
|
|
|
|
1;
|