123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace Tests\tripal_chado\api;
- use StatonLab\TripalTestSuite\DBTransaction;
- use StatonLab\TripalTestSuite\TripalTestCase;
- class TripalChadoOrganismAPITest extends TripalTestCase {
- use DBTransaction;
-
- public function test_tripal_get_organism() {
- $genus_string = 'a_genius_genus';
- $species_string = 'fake_species';
- $organism = factory('chado.organism')->create([
- 'genus' => $genus_string,
- 'species' => $species_string,
- ]);
- $results = [];
- $results[] = chado_get_organism(['organism_id' => $organism->organism_id]);
- $results[] = chado_get_organism([
- 'genus' => $genus_string,
- 'species' => $species_string,
- ]);
- foreach ($results as $result) {
- $this->assertNotFalse($result);
- $this->assertNotNull($result);
- $this->assertObjectHasAttribute('genus', $result);
- $this->assertEquals($genus_string, $result->genus);
- }
- }
-
- public function test_tripal_get_organism_fails_gracefully() {
- $result = chado_get_organism([
- 'genus' => uniqid(),
- 'species' => uniqid(),
- ]);
- $this->assertNull($result);
- }
-
- function test_tripal_get_organism_scientific_name() {
- $genus_string = 'a_genius_genus';
- $species_string = 'fake_species';
- $infraspecific_name = "infrawhat?";
- $term = factory('chado.cvterm')->create();
- $organism = factory('chado.organism')->create([
- 'genus' => $genus_string,
- 'species' => $species_string,
- 'infraspecific_name' => $infraspecific_name,
- 'type_id' => $term->cvterm_id,
- ]);
- $sci_name = chado_get_organism_scientific_name($organism);
- $this->assertEquals(implode(" ", [
- $genus_string,
- $species_string,
- $term->name,
- $infraspecific_name,
- ]), $sci_name);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
|