TripalChadoAPITest.php 872 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use StatonLab\TripalTestSuite\DBTransaction;
  3. use StatonLab\TripalTestSuite\TripalTestCase;
  4. class TripalChadoAPITest extends TripalTestCase {
  5. use DBTransaction;
  6. /**
  7. *
  8. *@test
  9. */
  10. public function test_tripal_chado_publish_records(){
  11. //create an organism, publish it
  12. $organism = factory('chado.organism')->create([
  13. 'genus' => 'a_genius_genus',
  14. 'species' => 'fake_species',
  15. ]);
  16. //get bundle ID for organism
  17. $bundle = db_select('public.chado_bundle', 'CB')
  18. ->fields('CB', ['bundle_id'])
  19. ->condition('data_table', 'organism')
  20. ->execute()->fetchField();
  21. $values = ['bundle_name' => 'bio_data_' . $bundle];
  22. ob_start();//dont display the job message
  23. $bool = tripal_chado_publish_records($values);
  24. ob_end_clean();
  25. $this->assertTrue($bool, 'Publishing a fake organism record failed');
  26. }
  27. }