DataFactory.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. });