1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace Tests\tripal_chado\api;
- use StatonLab\TripalTestSuite\DBTransaction;
- use StatonLab\TripalTestSuite\TripalTestCase;
- module_load_include('inc', 'tripal_chado', 'api/ChadoSchema');
- class ChadoComplianceTest extends TripalTestCase {
-
- use DBTransaction;
-
- public function chadoTableProvider() {
- $chado_schema = new \ChadoSchema();
- $version = $chado_schema->getVersion();
- $dataset = [];
- foreach ($chado_schema->getTableNames() as $table_name) {
- $dataset[] = [$version, $table_name];
- }
- return $dataset;
- }
-
- public function testTableCompliance($schema_version, $table_name) {
-
- $chado_schema = new \ChadoSchema();
- $version = $chado_schema->getVersion();
-
- $this->assertTrue(
- $chado_schema->checkTableExists($table_name),
- t('"!table_name" should exist in the "!chado" schema v!version.',
- array('!table_name' => $table_name, '!chado' => $schema_name, '!version' => $version))
- );
-
- $table_schema = $chado_schema->getTableSchema($table_name);
-
-
- foreach ($table_schema['fields'] as $column_name => $column_details) {
-
- $this->assertTrue(
- $chado_schema->checkColumnExists($table_name, $column_name),
- t('The column "!column" must exist in "!table" for chado v!version.',
- array('!column' => $column_name, '!table' => $table_name, '!version' => $version))
- );
-
- }
-
-
-
- }
- }
|