View | Details | Raw Unified | Return to bug 21846
Collapse All | Expand All

(-)a/Koha/Tag.pm (+42 lines)
Line 0 Link Here
1
package Koha::Tag;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use base qw(Koha::Object);
23
24
=head1 NAME
25
26
Koha::Tag - Koha Tag Object class
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=cut
33
34
=head3 _type
35
36
=cut
37
38
sub _type {
39
    return 'TagAll';
40
}
41
42
1;
(-)a/Koha/Tags.pm (+52 lines)
Line 0 Link Here
1
package Koha::Tags;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Tag;
23
24
use base qw(Koha::Objects);
25
26
=head1 NAME
27
28
Koha::Tags - Koha Tags Object set class
29
30
=head1 API
31
32
=head2 Internal methods
33
34
=cut
35
36
=head3 _type
37
38
=cut
39
40
sub _type {
41
    return 'TagAll';
42
}
43
44
=head3 object_class
45
46
=cut
47
48
sub object_class {
49
    return 'Koha::Tag';
50
}
51
52
1;
(-)a/Koha/Tags/Approval.pm (+42 lines)
Line 0 Link Here
1
package Koha::Tags::Approval;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use base qw(Koha::Object);
23
24
=head1 NAME
25
26
Koha::Tags::Approval - Koha Tag approval Object class
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=cut
33
34
=head3 _type
35
36
=cut
37
38
sub _type {
39
    return 'TagsApproval';
40
}
41
42
1;
(-)a/Koha/Tags/Approvals.pm (+52 lines)
Line 0 Link Here
1
package Koha::Tags::Approvals;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Tags::Approval;
23
24
use base qw(Koha::Objects);
25
26
=head1 NAME
27
28
Koha::Tags::Approvals - Koha Tag Approvals Object set class
29
30
=head1 API
31
32
=head2 Internal methods
33
34
=cut
35
36
=head3 _type
37
38
=cut
39
40
sub _type {
41
    return 'TagsApproval';
42
}
43
44
=head3 object_class
45
46
=cut
47
48
sub object_class {
49
    return 'Koha::Tags::Approval';
50
}
51
52
1;
(-)a/Koha/Tags/Index.pm (+42 lines)
Line 0 Link Here
1
package Koha::Tags::Index;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use base qw(Koha::Object);
23
24
=head1 NAME
25
26
Koha::Tags::Index - Koha Tag approval Object class
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=cut
33
34
=head3 _type
35
36
=cut
37
38
sub _type {
39
    return 'TagsIndex';
40
}
41
42
1;
(-)a/Koha/Tags/Indexes.pm (+52 lines)
Line 0 Link Here
1
package Koha::Tags::Indexes;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Tags::Index;
23
24
use base qw(Koha::Objects);
25
26
=head1 NAME
27
28
Koha::Tags::Indexes - Koha Tag Indexes Object set class
29
30
=head1 API
31
32
=head2 Internal methods
33
34
=cut
35
36
=head3 _type
37
38
=cut
39
40
sub _type {
41
    return 'TagsIndex';
42
}
43
44
=head3 object_class
45
46
=cut
47
48
sub object_class {
49
    return 'Koha::Tags::Index';
50
}
51
52
1;
(-)a/t/db_dependent/Koha/Tags.t (+45 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
22
use t::lib::TestBuilder;
23
24
use Koha::Database;
25
use Koha::Tags;
26
27
my $schema = Koha::Database->schema;
28
my $builder = t::lib::TestBuilder->new;
29
30
subtest 'search() tests' => sub {
31
32
    plan tests => 1;
33
34
    $schema->storage->txn_begin;
35
36
    my $current_count = Koha::Tags->search->count;
37
38
    my $approval_1 = $builder->build_object({ class => 'Koha::Tags' });
39
    my $approval_2 = $builder->build_object({ class => 'Koha::Tags' });
40
41
    is( Koha::Tags->search->count, $current_count + 2, 'Tags count consistent' );
42
43
    $schema->storage->txn_rollback;
44
45
};
(-)a/t/db_dependent/Koha/Tags/Approvals.t (+45 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
22
use t::lib::TestBuilder;
23
24
use Koha::Database;
25
use Koha::Tags::Approvals;
26
27
my $schema = Koha::Database->schema;
28
my $builder = t::lib::TestBuilder->new;
29
30
subtest 'search() tests' => sub {
31
32
    plan tests => 1;
33
34
    $schema->storage->txn_begin;
35
36
    my $current_count = Koha::Tags::Approvals->search->count;
37
38
    my $approval_1 = $builder->build_object({ class => 'Koha::Tags::Approvals' });
39
    my $approval_2 = $builder->build_object({ class => 'Koha::Tags::Approvals' });
40
41
    is( Koha::Tags::Approvals->search->count, $current_count + 2, 'Approvals count consistent' );
42
43
    $schema->storage->txn_rollback;
44
45
};
(-)a/t/db_dependent/Koha/Tags/Indexes.t (-1 / +45 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
22
use t::lib::TestBuilder;
23
24
use Koha::Database;
25
use Koha::Tags::Indexes;
26
27
my $schema = Koha::Database->schema;
28
my $builder = t::lib::TestBuilder->new;
29
30
subtest 'search() tests' => sub {
31
32
    plan tests => 1;
33
34
    $schema->storage->txn_begin;
35
36
    my $current_count = Koha::Tags::Indexes->search->count;
37
38
    my $approval_1 = $builder->build_object({ class => 'Koha::Tags::Indexes' });
39
    my $approval_2 = $builder->build_object({ class => 'Koha::Tags::Indexes' });
40
41
    is( Koha::Tags::Indexes->search->count, $current_count + 2, 'Indexes count consistent' );
42
43
    $schema->storage->txn_rollback;
44
45
};

Return to bug 21846