Skip to content

scabo/user-table-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of th data generator for User table

What is this?

In the software development process is often a need to test data. Anyway, the programmer needs to make sure that the program will work with the actual amount of data before it will give to the customer. In the case when the amount of data does not matter it will not cause serious problems, but what if that is supposed database table can contain more than 1000000 and more records? How to quickly and easily create test data for this table? This requires a flexible and simple tool capable of quickly generate test data in a useful format for import to the database. The solution to this issue is shown by the example of the data to for the user table

What was used?

  1. PHP5 as console applicaion
  2. Zend_Console_Getopt class for collect of the options
  3. Scabo_Heap - own library for generate random data

Architecture of the Scabo_Heap

For maximum flexibility, the application is divided into four parts:

  1. Settings source
  2. Settings reader
  3. Result writer
  4. Result target

Settings source

Provides configuration information for Settings Reader. It may be anything - file, string, etc.

Settings reader

Reads settings data from the source as some format. So you can implement reader for any format

Result writer

Converts generated data to the some format and move it to the target. Also you can implement writer to any format.

Result target

Writes generated data to somewhere. Usually, it's file, but you can implement any target - directory, string, etc.

Example

Please, put Zend Framework in library directory

Structure of data

  • id - increment - unique identifier
  • name - string - first name
  • surname - string - last name
  • dob - date - birthday
  • sex - enum(male of female) - gender
  • country_id - int - foreign key on country table
  • desc - string - description
  • active - bool - TRUE if record active, otherwise FALSE

Example of the settings file

Please, see settings.xml in the root

Console command

php run.php --settings-file=./settings.xml --settings-format=xml --output-dir=./output --output-format=csv

About

Example of using Heap library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published