DataFactory.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  67. Factory::define('chado.stock', function (Faker\Generator $faker) {
  68. return [
  69. 'name' => $faker->name,
  70. 'uniquename' => $faker->unique()->name,
  71. 'organism_id' => factory('chado.organism')->create()->organism_id,
  72. 'type_id' => factory('chado.cvterm')->create()->cvterm_id,
  73. ];
  74. });
  75. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  76. Factory::define('chado.project', function (Faker\Generator $faker) {
  77. return [
  78. 'name' => $faker->name,
  79. ];
  80. });
  81. Factory::define('chado.analysis', function (Faker\Generator $faker) {
  82. return [
  83. 'name' => $faker->name,
  84. 'description' => $faker->name,
  85. 'program' => $faker->unique()->name,
  86. 'programversion' => $faker->unique()->name,
  87. 'sourcename' => $faker->unique()->name,
  88. 'algorithm' => $faker->name,
  89. 'sourcename' => $faker->name,
  90. 'sourceversion' => $faker->name,
  91. 'sourceuri' => $faker->name,
  92. ];
  93. });
  94. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  95. Factory::define('tripal_jobs', function (Faker\Generator $faker) {
  96. return [
  97. 'uid' => 1,
  98. 'job_name' => $faker->sentence,
  99. 'modulename' => $faker->word,
  100. 'callback' => $faker->word,
  101. 'arguments' => serialize(['arg' => $faker->word]),
  102. 'progress' => 0,
  103. 'status' => $faker->randomElement([
  104. 'Waiting',
  105. 'Cancelled',
  106. 'Error',
  107. 'Completed',
  108. ]),
  109. 'submit_date' => time(),
  110. 'start_time' => NULL,
  111. 'end_time' => NULL,
  112. 'error_msg' => NULL,
  113. 'pid' => $faker->numberBetween(1, 10000),
  114. 'priority' => $faker->numberBetween(1, 10),
  115. ];
  116. }, 'job_id');
  117. /** @see StatonLab\TripalTestSuite\Database\Factory::define() */
  118. Factory::define('chado.pub', function (Faker\Generator $faker) {
  119. return [
  120. 'uniquename' => $faker->word,
  121. 'type_id' => factory('chado.cvterm')->create()->cvterm_id,
  122. ];
  123. });