Bugzilla – Attachment 156616 Details for
Bug 34336
Test::DBIx::Class should be removed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34336: Remove the dependency for Test::DBIx::Class
Bug-34336-Remove-the-dependency-for-TestDBIxClass.patch (text/plain), 5.11 KB, created by
Jonathan Druart
on 2023-10-06 11:45:57 UTC
(
hide
)
Description:
Bug 34336: Remove the dependency for Test::DBIx::Class
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-06 11:45:57 UTC
Size:
5.11 KB
patch
obsolete
>From 8d632f99fe868e8c8cea86ca5d7b642c2aaead51 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 6 Oct 2023 06:52:28 +0000 >Subject: [PATCH] Bug 34336: Remove the dependency for Test::DBIx::Class > >The module is removed from t. >We only have 01-test_dbic.t and we do not need it any longer. > >Test plan: >git grep for Test::DBIx::Class. You should only see release notes. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > cpanfile | 1 - > t/db_dependent/01-test_dbic.t | 110 ---------------------------------- > 2 files changed, 111 deletions(-) > delete mode 100755 t/db_dependent/01-test_dbic.t > >diff --git a/cpanfile b/cpanfile >index 807dfa31df3..711b604e316 100644 >--- a/cpanfile >+++ b/cpanfile >@@ -166,7 +166,6 @@ recommends 'Selenium::Remote::Driver', '1.27'; > recommends 'Starman', '0.4014'; > recommends 'Sys::CPU', '0.52'; > recommends 'Template::Plugin::Stash', '1.006'; >-recommends 'Test::DBIx::Class', '0.42'; > recommends 'Test::Deep', '0.106'; > recommends 'Test::Exception', '0.35'; > recommends 'Test::MockObject', '1.09'; >diff --git a/t/db_dependent/01-test_dbic.t b/t/db_dependent/01-test_dbic.t >deleted file mode 100755 >index 63dd55f690f..00000000000 >--- a/t/db_dependent/01-test_dbic.t >+++ /dev/null >@@ -1,110 +0,0 @@ >-#!/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; >-use Test::MockModule; >- >-use Koha::Database; >-use Koha::Libraries; >- >-subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { >- my ( $firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount ); >- >- eval { >- >- ok( >- $firstSchema = Koha::Database->schema, >- 'Step: Given a normal DB connection.' >- ); >- >- $firstLibCount = >- Koha::Libraries->search->count; # first count normal conn >- >- ok( $cachedSchema = Koha::Database::get_schema_cached(), >- ' And the DB connection is cached' ); >- >- unlike( getConnectionDBName($cachedSchema), >- qr/sqlite/i, ' And the cached DB connection type is not sqlite' ); >- >- use_ok('Test::DBIx::Class'); >- my $db = Test::MockModule->new('Koha::Database'); >- $db->mock( _new_schema => sub { return Schema(); } ); >- ok( 1, >-'Step: Given Test::DBIx::Class (T:D:C) is loaded and DB accessor is mocked. Connection from cache is still used.' >- ); >- >- $libCount = Koha::Libraries->search->count; >- >- is( $libCount, $firstLibCount, >- ' Then we got the same count as without T:D:C' ); >- >- $cachedSchema = Koha::Database::get_schema_cached(); >- is( $cachedSchema, $firstSchema, >- ' And the cached DB connection is the same as without T:D:C' ); >- >- is( >- getConnectionDBName($cachedSchema), >- getConnectionDBName($firstSchema), >- ' And the cached DB connection type is unchanged' >- ); >- >- ok( Koha::Database::flush_schema_cache(), >- 'Step: Given the DB connection cache is flushed' ); >- >- $libCount = Koha::Libraries->search->count; >- >- is( $libCount, 0, >- ' Then we got 0 libraries because fixtures are not deployed' ); >- >- $cachedSchema = Koha::Database::get_schema_cached(); >- isnt( $cachedSchema, $firstSchema, >- ' And the cached DB connection has changed' ); >- >- like( getConnectionDBName($cachedSchema), >- qr/sqlite/i, ' And the cached DB connection type is sqlite' ); >- >- fixtures_ok( >- [ #Dynamically load fixtures, because we dynamically load T:D:C. Otherwise there be compile errors! >- Branch => [ >- [ 'branchcode', 'branchname' ], >- [ 'XXX_test', 'my branchname XXX' ], >- ] >- ], >- 'Step: Given we deploy T:D:C Fixtures' >- ); >- >- $libCount = Koha::Libraries->search->count; >- >- is( $libCount, 1, ' Then we got the count from fixtures' ); >- >- $cachedSchema2 = Koha::Database::get_schema_cached(); >- is( $cachedSchema2, $cachedSchema, >- ' And the cached DB connection is the same from T:D:C' ); >- >- like( getConnectionDBName($cachedSchema), >- qr/sqlite/i, ' And the cached DB connection type is sqlite' ); >- >- }; >- ok( 0, $@ ) if $@; >- }; >- >-done_testing; >- >-sub getConnectionDBName { >- return shift->storage->connect_info->[0]->{dsn}; >-} >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34336
:
156589
| 156616