Browse Source

Unit test for escaped characters with tag values

Risharde Ramnath 4 years ago
parent
commit
ac790a4eeb

+ 4 - 7
tests/tripal_chado/loaders/GFF3ImporterTest.php

@@ -100,7 +100,7 @@ class GFF3ImporterTest extends TripalTestCase {
    * This tests whether the GFF loader adds IDs that contain a comma. 
    * The GFF loader should allow it
    */  
-  public function testGFFImporterEscapedTagValueWithComma() {
+  public function testGFFImporterEscapedTagValueWithEncodedCharacter() {
     $gff_file = ['file_local' => __DIR__ . '/../data/gff_tagvalue_encoded_character.gff'];
     $analysis = factory('chado.analysis')->create();
     $organism = factory('chado.organism')->create();
@@ -127,13 +127,10 @@ class GFF3ImporterTest extends TripalTestCase {
     $this->loadLandmarks($analysis, $organism);
     $this->runGFFLoader($run_args, $gff_file);
 
-    $results = db_query("SELECT * FROM chado.feature",array());
-
-    foreach ($results as $row) {
-      print_r($row);
-    }
+    $results = db_query("SELECT * FROM chado.feature 
+      WHERE uniquename = 'FRAEX38873_v2_000000010,20';",array());
 
-    //$this->assertEquals($hasException, true);
+    $this->assertEquals($results->rowCount(), 1);
   }
 
 

+ 1 - 7
tripal_chado/includes/TripalImporter/GFF3Importer.inc

@@ -1025,13 +1025,7 @@ class GFF3Importer extends TripalImporter {
         unescaped characters', ['!value' => $tag[1]])
         );
       }
-
-      // Let us convert escaped characters back to original 
-      // Is this too general?\
-      $tag[0] = urldecode($tag[0]);
-      $tag[1] = urldecode($tag[1]);
-
-
+      
       // Multiple values of an attribute are separated by commas
       $tag_name = $tag[0];
       if (!array_key_exists($tag_name, $tags)) {