|
Lines 42-75
my $typeA = $builder->build_object(
Link Here
|
| 42 |
class => 'Koha::Patron::Attribute::Types', |
42 |
class => 'Koha::Patron::Attribute::Types', |
| 43 |
value => { |
43 |
value => { |
| 44 |
staff_searchable => 0, |
44 |
staff_searchable => 0, |
| 45 |
description => "Desc type A", |
45 |
description => "Desc type A", |
| 46 |
} |
46 |
} |
| 47 |
} |
47 |
} |
| 48 |
); |
48 |
); |
| 49 |
my $typeB = $builder->build_object( |
49 |
my $typeB = $builder->build_object( |
| 50 |
{ |
50 |
{ |
| 51 |
class => 'Koha::Patron::Attribute::Types', |
51 |
class => 'Koha::Patron::Attribute::Types', |
| 52 |
value => { |
52 |
value => { |
| 53 |
staff_searchable => 1, |
53 |
staff_searchable => 1, |
| 54 |
description => "Desc type B", |
54 |
description => "Desc type B", |
| 55 |
} |
55 |
} |
| 56 |
} |
56 |
} |
| 57 |
); |
57 |
); |
| 58 |
|
58 |
|
| 59 |
my $all_plugin = $plugin->all(); |
59 |
my $all_plugin = $plugin->all(); |
| 60 |
my $all_objects = Koha::Patron::Attribute::Types->search(); |
60 |
my $all_objects = Koha::Patron::Attribute::Types->search(); |
| 61 |
|
61 |
|
| 62 |
is_deeply( $all_plugin->unblessed, $all_objects->unblessed, "all method returns all the types correctly"); |
62 |
is_deeply( $all_plugin->unblessed, $all_objects->unblessed, "all method returns all the types correctly" ); |
| 63 |
|
63 |
|
| 64 |
my $all_plugin_codes = $plugin->codes(); |
64 |
my $all_plugin_codes = $plugin->codes(); |
| 65 |
my $all_object_codes = Koha::Patron::Attribute::Types->search()->get_column('code'); |
65 |
my $all_object_codes = Koha::Patron::Attribute::Types->search()->get_column('code'); |
| 66 |
|
66 |
|
| 67 |
is_deeply( $all_plugin_codes, $all_object_codes, "codes method returns the codes as expected"); |
67 |
is_deeply( $all_plugin_codes, $all_object_codes, "codes method returns the codes as expected" ); |
| 68 |
|
68 |
|
| 69 |
my $searchable_plugin_codes = $plugin->codes({ staff_searchable => 1 }); |
69 |
my $searchable_plugin_codes = $plugin->codes( { staff_searchable => 1 } ); |
| 70 |
my $searchable_object_codes = Koha::Patron::Attribute::Types->search({ staff_searchable => 1 })->get_column('code'); |
70 |
my $searchable_object_codes = Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code'); |
| 71 |
|
71 |
|
| 72 |
is_deeply( $searchable_plugin_codes, $searchable_object_codes, "searching plugin method works as expected"); |
72 |
is_deeply( $searchable_plugin_codes, $searchable_object_codes, "searching plugin method works as expected" ); |
| 73 |
|
73 |
|
| 74 |
$schema->storage->txn_rollback; |
74 |
$schema->storage->txn_rollback; |
| 75 |
|
75 |
|
| 76 |
- |
|
|