Currently, only jenkins is able to launch tests successfully. It would great to have a file in the db_dependent directory to initialize the database structure with sample data. Like that all developers will be able to launch unit tests and check if a development breaks something.
Created attachment 18389 [details] [review] Bug 10337: Unit tests is based on an existing database This patchs adds a new unit tests file which will launched before all others db_dependent tests. It will drop and recreate the database with sample data. Prerequisite: The database 'koha_ut' have to be created with CREATE DATABASE $dbname CHARACTER SET utf8 COLLATE utf8_bin
This patch is proposed for discussion.
Created attachment 18390 [details] [review] Bug 10337: Unit tests is based on an existing database This patchs adds a new unit tests file which will launched before all others db_dependent tests. It will drop and recreate the database with sample data. Prerequisite: The database 'koha_ut' have to be created with CREATE DATABASE $dbname CHARACTER SET utf8 COLLATE utf8_bin
I like this idea, it might be nicer to rework it to use the new schema rather than kohastructure.sql now though. That way we could test deploying the schema also.
I'm wondering if https://metacpan.org/pod/DBIx::Class::Fixtures may actaully be a nicer way to impliment this now?
Created attachment 42784 [details] [review] Bug 10337: Unit tests is based on an existing database This patchs adds a new unit tests file which will launched before all others db_dependent tests. It will drop and recreate the database with sample data. Prerequisite: The database 'koha_ut' have to be created with CREATE DATABASE $dbname CHARACTER SET utf8 COLLATE utf8_bin
I reworked this patch to create a misc/devel script inserting all the sample data in the DB.
Created attachment 56607 [details] [review] Bug 10337: Add a script to populate devs' DBs with sample data Executing the installer process and inserting all the sample data take a lot of clics and time. The idea of this script is to provide a quick way to insert all the sample data easily to get a working Koha install asap. Test plan: - Set your database config to a non-existent DB - Execute perl misc/devel/populate_db.pl You will get an error - Create an empty DB - Execute perl misc/devel/populate_db.pl It will insert all the MARC21 sample data - Execute perl misc/devel/populate_db.pl You will get an error because the DB is not empty (systempreferences and borrowers tables)
*** Bug 15392 has been marked as a duplicate of this bug. ***
Created attachment 56614 [details] [review] Bug 10337: Add a script to populate devs' DBs with sample data Executing the installer process and inserting all the sample data take a lot of clics and time. The idea of this script is to provide a quick way to insert all the sample data easily to get a working Koha install asap. Test plan: - Set your database config to a non-existent DB - Execute perl misc/devel/populate_db.pl You will get an error - Create an empty DB - Execute perl misc/devel/populate_db.pl It will insert all the MARC21 sample data - Execute perl misc/devel/populate_db.pl You will get an error because the DB is not empty (systempreferences and borrowers tables) Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 56621 [details] [review] Bug 10337: Add a script to populate devs' DBs with sample data Executing the installer process and inserting all the sample data take a lot of clics and time. The idea of this script is to provide a quick way to insert all the sample data easily to get a working Koha install asap. Test plan: - Set your database config to a non-existent DB - Execute perl misc/devel/populate_db.pl You will get an error - Create an empty DB - Execute perl misc/devel/populate_db.pl It will insert all the MARC21 sample data - Execute perl misc/devel/populate_db.pl You will get an error because the DB is not empty (systempreferences and borrowers tables) Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 56622 [details] [review] Bug 10337: (QA followup) Allow choosing MARC flavour This patch enables the --marcflavour option switch so the user can specify the desired marc flavour. The code for handling it was already in place, just not used. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 56625 [details] [review] Bug 10337: (followup) Upper case MARC flavour This patch makes the populate_db.pl script upper case what gets passed with the --marcflavour option switch. This is needed in order for this to fit ``kohadevbox`` configuration files, and it is harmless for other uses. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Push to master for 16.11, thanks Jonathan!
Pushed in 16.05. Will be in 16.05.05.
Should this script be removed now that we use misc4dev?
(In reply to David Cook from comment #16) > Should this script be removed now that we use misc4dev? Related bug removed it
(In reply to Jonathan Druart from comment #17) > Related bug removed it Thanks, Jonathan. I was looking at a slightly out of date 19.11 [U+1F605]