12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace Tests\api;
- use StatonLab\TripalTestSuite\DBTransaction;
- use StatonLab\TripalTestSuite\TripalTestCase;
- class BlastDBApiTest extends TripalTestCase {
-
- use DBTransaction;
-
- public function testGetBlastDB() {
-
- $seeder = \Tests\DatabaseSeeders\BlastDBNodeSeeder::seed();
- $node = $seeder->getNode();
-
-
- $resultdb = get_blast_database(['nid' => $node->nid]);
- $this->assertEquals($node->nid, $resultdb->nid,
- "Unable to find the correct blast database based on nid.");
-
- $resultdb = get_blast_database(['name' => $node->db_name]);
- $this->assertEquals($node->nid, $resultdb->nid,
- "Unable to find the correct blast database based on name.");
-
- $resultdb = get_blast_database(['path' => $node->db_path]);
- $this->assertEquals($node->nid, $resultdb->nid,
- "Unable to find the correct blast database based on path.");
- }
-
- public function testGetBlastDBOptions() {
-
- $nodes = array();
- $seeder = \Tests\DatabaseSeeders\BlastDBNodeSeeder::seed();
- $nodes[] = $seeder->getNode();
- $seeder = \Tests\DatabaseSeeders\BlastDBNodeSeeder::seed();
- $nodes[] = $seeder->getNode();
- $seeder = \Tests\DatabaseSeeders\BlastDBNodeSeeder::seed();
- $nodes[] = $seeder->getNode();
- $options = get_blast_database_options('nucleotide');
- $this->assertGreaterThanOrEqual(3, sizeof($options),
- "Did not retrieve all 3 nodes we inserted as options.");
-
- foreach ($nodes as $node) {
- $this->assertArrayHasKey($node->nid, $options,
- "Unable to find a specific node option that we know should be there.");
- }
-
- $retrieved_nodes = get_blast_database_nodes();
- $this->assertGreaterThanOrEqual(3, sizeof($retrieved_nodes),
- "Unable to retrieve the nodes at all.");
- foreach ($nodes as $node) {
- $this->assertArrayHasKey($node->nid, $retrieved_nodes,
- "Unable to find a specific node option that we know should be there.");
- }
- }
- }
|