DataFactory.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. use StatonLab\TripalTestSuite\Database\Factory;
  3. /**
  4. * Data Factory
  5. * -----------------------------------------------------------
  6. * This is where you can define factories for use in tests and
  7. * database seeders.
  8. *
  9. * @docs https://github.com/statonlab/TripalTestSuite
  10. */
  11. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  12. Factory::define('chado.cv', function (Faker\Generator $faker) {
  13. return [
  14. 'name' => $faker->name,
  15. 'definition' => $faker->text,
  16. ];
  17. });
  18. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  19. Factory::define('chado.db', function (Faker\Generator $faker) {
  20. return [
  21. 'name' => $faker->name,
  22. 'description' => $faker->text,
  23. 'urlprefix' => $faker->url,
  24. 'url' => $faker->url,
  25. ];
  26. });
  27. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  28. Factory::define('chado.dbxref', function (Faker\Generator $faker) {
  29. return [
  30. 'db_id' => factory('chado.db')->create()->db_id,
  31. 'accession' => $faker->numberBetween(),
  32. 'version' => $faker->numberBetween(),
  33. 'description' => $faker->text,
  34. ];
  35. });
  36. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  37. Factory::define('chado.cvterm', function (Faker\Generator $faker) {
  38. return [
  39. 'cv_id' => factory('chado.cv')->create()->cv_id,
  40. 'dbxref_id' => factory('chado.dbxref')->create()->dbxref_id,
  41. 'name' => $faker->name,
  42. 'definition' => $faker->text,
  43. 'is_obsolete' => 0,
  44. 'is_relationshiptype' => 0,
  45. ];
  46. });
  47. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  48. Factory::define('chado.organism', function (Faker\Generator $faker) {
  49. return [
  50. 'abbreviation' => $faker->name,
  51. 'genus' => $faker->name,
  52. 'species' => $faker->name,
  53. 'common_name' => $faker->name,
  54. 'type_id' => factory('chado.cvterm')->create()->cvterm_id,
  55. ];
  56. });
  57. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  58. Factory::define('chado.feature', function (Faker\Generator $faker) {
  59. return [
  60. 'name' => $faker->name,
  61. 'uniquename' => $faker->unique()->name,
  62. 'organism_id' => factory('chado.organism')->create()->organism_id,
  63. 'type_id' => factory('chado.cvterm')->create()->cvterm_id,
  64. ];
  65. });
  66. Factory::define('chado.analysis', function (Faker\Generator $faker) {
  67. return [
  68. 'name' => $faker->name,
  69. 'description' => $faker->name,
  70. 'program' => $faker->unique()->name,
  71. 'programversion' => $faker->unique()->name,
  72. 'sourcename' => $faker->unique()->name,
  73. 'algorithm' => $faker->name,
  74. 'sourcename' => $faker->name,
  75. 'sourceversion' => $faker->name,
  76. 'sourceuri' => $faker->name,
  77. ];
  78. });
  79. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  80. Factory::define('tripal_jobs', function (Faker\Generator $faker) {
  81. return [
  82. 'uid' => 1,
  83. 'job_name' => $faker->sentence,
  84. 'modulename' => $faker->word,
  85. 'callback' => $faker->word,
  86. 'arguments' => serialize(['arg' => $faker->word]),
  87. 'progress' => 0,
  88. 'status' => $faker->randomElement([
  89. 'Waiting',
  90. 'Cancelled',
  91. 'Error',
  92. 'Completed',
  93. ]),
  94. 'submit_date' => time(),
  95. 'start_time' => NULL,
  96. 'end_time' => NULL,
  97. 'error_msg' => NULL,
  98. 'pid' => $faker->numberBetween(1, 10000),
  99. 'priority' => $faker->numberBetween(1, 10),
  100. ];
  101. }, 'job_id');