TripalChadoCustomTablesAPITest.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. namespace Tests\tripal_chado\api;
  3. use StatonLab\TripalTestSuite\DBTransaction;
  4. use StatonLab\TripalTestSuite\TripalTestCase;
  5. class TripalChadoCustomTablesAPITest extends TripalTestCase {
  6. use DBTransaction;
  7. /**
  8. * Test creation of a new materialized view.
  9. *
  10. * @group api
  11. */
  12. public function test_chado_add_mview() {
  13. // TODO: this is currently a stub for a test function that neds
  14. // implementation. For now it returns true to get past unit testing.
  15. $this->assertTrue(true);
  16. }
  17. /**
  18. * Test deletion of a materialized view.
  19. *
  20. * @group api
  21. */
  22. public function test_chado_delete_mview() {
  23. // TODO: this is currently a stub for a test function that neds
  24. // implementation. For now it returns true to get past unit testing.
  25. $this->assertTrue(true);
  26. }
  27. /**
  28. * Test modifications to a materialized view
  29. *
  30. * @group api
  31. */
  32. public function test_chado_edit_mview() {
  33. // TODO: this is currently a stub for a test function that neds
  34. // implementation. For now it returns true to get past unit testing.
  35. $this->assertTrue(true);
  36. }
  37. /**
  38. * Test adding a Tripal Job to re-populate a materialized view
  39. *
  40. * @group api
  41. */
  42. public function test_chado_refresh_mview() {
  43. // TODO: this is currently a stub for a test function that neds
  44. // implementation. For now it returns true to get past unit testing.
  45. $this->assertTrue(true);
  46. }
  47. /**
  48. * Test re-populating a materialized view.
  49. *
  50. * @group api
  51. */
  52. public function test_chado_populate_mview() {
  53. // TODO: this is currently a stub for a test function that neds
  54. // implementation. For now it returns true to get past unit testing.
  55. $this->assertTrue(true);
  56. }
  57. /**
  58. * Test modifications to a materialized view
  59. *
  60. * @group api
  61. */
  62. public function test_chado_get_mview_id() {
  63. // TODO: this is currently a stub for a test function that neds
  64. // implementation. For now it returns true to get past unit testing.
  65. $this->assertTrue(true);
  66. }
  67. /**
  68. * Test retrieving names of the materialized views.
  69. *
  70. * @group api
  71. */
  72. public function test_chado_get_mview_table_names() {
  73. // TODO: this is currently a stub for a test function that neds
  74. // implementation. For now it returns true to get past unit testing.
  75. $this->assertTrue(true);
  76. }
  77. /**
  78. * Test retrieving all materialized view objects.
  79. *
  80. * @group api
  81. */
  82. public function test_chado_get_mviews() {
  83. // TODO: this is currently a stub for a test function that neds
  84. // implementation. For now it returns true to get past unit testing.
  85. $this->assertTrue(true);
  86. }
  87. /**
  88. * Issue 322 reported the problem of re-adding a materialized view after
  89. * the actual table had been manually removed outside of Tripal. The
  90. * function reported errors.
  91. *
  92. * @ticket 322
  93. */
  94. public function test_re_adding_deleted_mview_issue_322() {
  95. $mview_table = 'analysis_organism';
  96. $mview_sql = "
  97. SELECT DISTINCT A.analysis_id, O.organism_id
  98. FROM analysis A
  99. INNER JOIN analysisfeature AF ON A.analysis_id = AF.analysis_id
  100. INNER JOIN feature F ON AF.feature_id = F.feature_id
  101. INNER JOIN organism O ON O.organism_id = F.organism_id
  102. ";
  103. $mview_schema = "array (
  104. 'table' => 'analysis_organism',
  105. 'description' => 'This view is for associating an organism (via it\'s associated features) to an analysis.',
  106. 'fields' => array (
  107. 'analysis_id' => array (
  108. 'size' => 'big',
  109. 'type' => 'int',
  110. 'not null' => true,
  111. ),
  112. 'organism_id' => array (
  113. 'size' => 'big',
  114. 'type' => 'int',
  115. 'not null' => true,
  116. ),
  117. ),
  118. 'indexes' => array (
  119. 'networkmod_qtl_indx0' => array (
  120. 0 => 'analysis_id',
  121. ),
  122. 'networkmod_qtl_indx1' => array (
  123. 0 => 'organism_id',
  124. ),
  125. ),
  126. 'foreign keys' => array (
  127. 'analysis' => array (
  128. 'table' => 'analysis',
  129. 'columns' => array (
  130. 'analysis_id' => 'analysis_id',
  131. ),
  132. ),
  133. 'organism' => array (
  134. 'table' => 'organism',
  135. 'columns' => array (
  136. 'organism_id' => 'organism_id',
  137. ),
  138. ),
  139. ),
  140. )";
  141. // First add the mview normally:
  142. chado_add_mview($mview_table, 'tripal_chado', $mview_schema, $mview_sql, NULL, FALSE);
  143. $this->assertTrue(true);
  144. }
  145. }