DataFactory.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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('tripal_jobs', function (Faker\Generator $faker) {
  68. return [
  69. 'uid' => 1,
  70. 'job_name' => $faker->sentence,
  71. 'modulename' => $faker->word,
  72. 'callback' => $faker->word,
  73. 'arguments' => serialize(['arg' => $faker->word]),
  74. 'progress' => 0,
  75. 'status' => $faker->randomElement([
  76. 'Waiting',
  77. 'Cancelled',
  78. 'Error',
  79. 'Completed',
  80. ]),
  81. 'submit_date' => time(),
  82. 'start_time' => NULL,
  83. 'end_time' => NULL,
  84. 'error_msg' => NULL,
  85. 'pid' => $faker->numberBetween(1, 10000),
  86. 'priority' => $faker->numberBetween(1, 10),
  87. ];
  88. }, 'job_id');