Browse Source

Chado getValueList(): comments and composer version bump.

Lacey Sanderson 6 years ago
parent
commit
853faa5d46
2 changed files with 30 additions and 11 deletions
  1. 11 11
      composer.lock
  2. 19 0
      tests/tripal_chado/fields/ChadoFieldGetValuesListTest.php

+ 11 - 11
composer.lock

@@ -1596,7 +1596,7 @@
         },
         {
             "name": "symfony/console",
-            "version": "v3.4.14",
+            "version": "v3.4.15",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/console.git",
@@ -1665,16 +1665,16 @@
         },
         {
             "name": "symfony/debug",
-            "version": "v3.4.14",
+            "version": "v3.4.15",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/debug.git",
-                "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc"
+                "reference": "c4625e75341e4fb309ce0c049cbf7fb84b8897cd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc",
-                "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc",
+                "url": "https://api.github.com/repos/symfony/debug/zipball/c4625e75341e4fb309ce0c049cbf7fb84b8897cd",
+                "reference": "c4625e75341e4fb309ce0c049cbf7fb84b8897cd",
                 "shasum": ""
             },
             "require": {
@@ -1717,7 +1717,7 @@
             ],
             "description": "Symfony Debug Component",
             "homepage": "https://symfony.com",
-            "time": "2018-07-26T11:19:56+00:00"
+            "time": "2018-08-03T10:42:44+00:00"
         },
         {
             "name": "symfony/polyfill-ctype",
@@ -1838,16 +1838,16 @@
         },
         {
             "name": "symfony/yaml",
-            "version": "v3.4.14",
+            "version": "v3.4.15",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/yaml.git",
-                "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2"
+                "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2",
-                "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2",
+                "url": "https://api.github.com/repos/symfony/yaml/zipball/c2f4812ead9f847cb69e90917ca7502e6892d6b8",
+                "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8",
                 "shasum": ""
             },
             "require": {
@@ -1893,7 +1893,7 @@
             ],
             "description": "Symfony Yaml Component",
             "homepage": "https://symfony.com",
-            "time": "2018-07-26T11:19:56+00:00"
+            "time": "2018-08-10T07:34:36+00:00"
         },
         {
             "name": "webmozart/assert",

+ 19 - 0
tests/tripal_chado/fields/ChadoFieldGetValuesListTest.php

@@ -55,6 +55,11 @@ class ChadoFieldGetValuesListTest extends TripalTestCase {
     $this->assertLessThanOrEqual(5, sizeof($values),
       t('Returned too many results for @field_name.', array('@field_name' => $field_name)));
 
+    // @todo Ensure a known value is in the list.
+    // Note: This requires insertion of data using factories. However, there are not yet
+    // factories for all chado tables and I don't know how to test if there is one for the
+    // current bundle base table. See issue statonlab/TripalTestSuite#92
+
   }
 
   /**
@@ -121,6 +126,10 @@ class ChadoFieldGetValuesListTest extends TripalTestCase {
       t('Returned too many results for @field_name.', array('@field_name' => $field_name)));
 
     // @todo Ensure it works with a label string set.
+    // @todo Ensure a known value is in the list.
+    // Note: This requires insertion of data using factories. However, there are not yet
+    // factories for all chado tables and I don't know how to test if there is one for the
+    // current bundle base table. See issue statonlab/TripalTestSuite#92
 
   }
 
@@ -221,17 +230,23 @@ class ChadoFieldGetValuesListTest extends TripalTestCase {
 
       $this->field_list = array();
 
+      // field_info_instances() retrieves a list of all the field instances in the current site,
+      // indexed by the bundle it is attached to.
+      // @todo use fake bundles here to make these tests less dependant upon the current site.
       $bundles = field_info_instances('TripalEntity');
       foreach($bundles as $bundle_name => $fields) {
 
+        // Load the bundle object to later determine the chado table.
         $bundle = tripal_load_bundle_entity(array('name'=> $bundle_name));
 
+        // For each field instance...
         foreach ($fields as $field_name => $instance_info) {
           $bundle_base_table = $base_schema = NULL;
 
           // Load the field info.
           $field_info = field_info_field($field_name);
 
+          // Determine the storage backend.
           $storage = $field_info['storage']['type'];
 
           // If this field stores it's data in chado...
@@ -263,6 +278,7 @@ class ChadoFieldGetValuesListTest extends TripalTestCase {
             }
           }
 
+          // Store all the info about bundle, field, instance, schema for use in the test.
           $info = array(
             'field_name' => $field_name,
             'bundle_name' => $bundle_name,
@@ -273,8 +289,11 @@ class ChadoFieldGetValuesListTest extends TripalTestCase {
             'instance_info' => $instance_info,
           );
 
+          // Create a unique key.
           $key = $bundle_name . '--' . $field_name;
 
+          // If this bundle uses chado and we know the fields relationship to the base
+          // chado table, then we want to index the field list by that relationship.
           if ($rel) {
             $this->field_list[$storage][$rel][$key] = array(
               $field_name,