|
@@ -58,7 +58,37 @@ class TripalContentTest extends TripalTestCase{
|
|
|
$this->assertEquals($json['label'], "$label Collection");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public function testGettingAFeatureResource() {
|
|
|
-
|
|
|
+
|
|
|
+ $mRNA_term = db_query('SELECT * FROM chado.cvterm WHERE name=:name',
|
|
|
+ [':name' => 'mRNA'])->fetchObject();
|
|
|
+ $this->assertNotEmpty($mRNA_term);
|
|
|
+
|
|
|
+ $feature = factory('chado.feature')->create([
|
|
|
+ 'type_id' => $mRNA_term->cvterm_id,
|
|
|
+ ]);
|
|
|
+ $this->publish('feature', [$feature->feature_id]);
|
|
|
+
|
|
|
+
|
|
|
+ $entity_id = chado_get_record_entity_by_table('feature', $feature->feature_id);
|
|
|
+ $this->assertNotEmpty($entity_id);
|
|
|
+
|
|
|
+
|
|
|
+ $response = $this->get("/web-services/content/v0.1/mRNA/$entity_id");
|
|
|
+ $response->assertSuccessful();
|
|
|
+
|
|
|
+ $response->assertJsonStructure([
|
|
|
+ '@context',
|
|
|
+ '@id',
|
|
|
+ '@type',
|
|
|
+ 'label',
|
|
|
+ 'ItemPage',
|
|
|
+ 'type',
|
|
|
+ ]);
|
|
|
+
|
|
|
+
|
|
|
+ $data = $response->json();
|
|
|
+ $this->assertEquals($feature->name, $data['name']);
|
|
|
}
|
|
|
}
|