7 use Test
::More tests
=> 11;
11 use_ok
('C4::Matcher');
14 use Test
::DBIx
::Class
{
15 schema_class
=> 'Koha::Schema',
16 connect_info
=> ['dbi:SQLite:dbname=:memory:','',''],
17 connect_opts
=> { name_sep
=> '.', quote_char
=> '`', },
18 fixture_class
=> '::Populate',
23 [ 'matcher_id', 'code', 'description', 'record_type', 'threshold' ],
24 [ 1, 'ISBN', 'ISBN', 'red', 1 ],
25 [ 2, 'ISSN', 'ISSN', 'blue', 0 ]
29 my $db = Test
::MockModule
->new('Koha::Database');
30 $db->mock( _new_schema
=> sub { return Schema
(); } );
32 my @matchers = C4
::Matcher
::GetMatcherList
();
34 is
( $matchers[0]->{'matcher_id'}, 1, 'First matcher_id value is 1' );
36 is
( $matchers[1]->{'matcher_id'}, 2, 'Second matcher_id value is 2' );
38 my $matcher_id = C4
::Matcher
::GetMatcherId
('ISBN');
40 is
( $matcher_id, 1, 'testing getmatcherid' );
44 ok
( $testmatcher = C4
::Matcher
->new( 'red', 1 ), 'testing matcher new' );
46 ok
( $testmatcher = C4
::Matcher
->new( 'blue', 0 ), 'testing matcher new' );
48 $testmatcher->threshold(1000);
50 is
( $testmatcher->threshold(), 1000, 'testing threshhold accessor method' );
52 $testmatcher->_id(53);
54 is
( $testmatcher->_id(), 53, 'testing _id accessor' );
56 $testmatcher->code('match on ISBN');
58 is
( $testmatcher->code(), 'match on ISBN', 'testing code accessor' );
60 $testmatcher->description('match on ISSN');
62 is
( $testmatcher->description(), 'match on ISSN', 'testing code accessor' );