Skip to content

Commit

Permalink
Merge pull request #141 from TripalCultivate/g0.140-BringImporterShar…
Browse files Browse the repository at this point in the history
…eToStandard

G0.140 - Bring to standard code in Phenotypes Share/Collect Importer
  • Loading branch information
reynoldtan authored Jan 30, 2025
2 parents 547d8b6 + 16629d3 commit 5f8f15e
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 214 deletions.
33 changes: 24 additions & 9 deletions trpcultivate_phenocollect/tests/src/Functional/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,56 @@

namespace Drupal\Tests\trpcultivate_phenocollect\Functional;

use Drupal\Core\Routing\RouteMatch;
use Drupal\Core\Url;
use Drupal\Tests\tripal_chado\Functional\ChadoTestBrowserBase;

/**
* Simple test to ensure that main page loads with module enabled.
*
* @group TripGeno Genetics
* @group TripPheno Collect
* @group Installation
*/
class InstallTest extends ChadoTestBrowserBase {

/**
* Default theme.
*
* @var string
*/
protected $defaultTheme = 'stark';

/**
* Modules to enable.
*
* @var array
*/
protected static $modules = ['help', 'trpcultivate_phenotypes', 'trpcultivate_phenocollect'];
protected static $modules = [
'help',
'trpcultivate_phenotypes',
'trpcultivate_phenocollect',
];

/**
* The name of your module in the .info.yml
* The name of your module in the .info.yml.
*
* @var string
*/
protected static $module_name = 'Phenotypic Data Collection';

/**
* The machine name of this module.
*
* @var string
*/
protected static $module_machinename = 'trpcultivate_phenocollect';

/**
* A small excert from your help page.
* Do not cross newlines.
* A small excert from your help page (Do not cross newlines).
*
* @var string
*/
protected static $help_text_excerpt = 'tools to backup and upload phenotypic data while it is being collected in a access controlled environment.';
protected static $help_text_excerpt = 'tools to backup and upload phenotypic data while it is being collected in an access controlled environment.';

/**
* Tests that a specific set of pages load with a 200 response.
Expand All @@ -59,7 +74,7 @@ public function testLoad() {
$this->drupalGet('admin/modules');
$status_code = $session->getStatusCode();
$this->assertEquals(200, $status_code, "The module install page should be able to load $context.");
$this->assertSession()->pageTextContains( self::$module_name );
$this->assertSession()->pageTextContains(self::$module_name);

}

Expand All @@ -72,15 +87,15 @@ public function testHelp() {
$some_extected_text = self::$help_text_excerpt;

// Ensure we have an admin user.
$permissions = ['access administration pages','administer modules', 'access help pages'];
$permissions = ['access administration pages', 'administer modules', 'access help pages'];
$user = $this->drupalCreateUser($permissions);
$this->drupalLogin($user);

$context = '(modules installed: ' . implode(',', self::$modules) . ')';

// Call the hook to ensure it is returning text.
$name = 'help.page.' . $this::$module_machinename;
$match = $this->createStub(\Drupal\Core\Routing\RouteMatch::class);
$match = $this->createStub(RouteMatch::class);
$hook_name = self::$module_machinename . '_help';
$output = $hook_name($name, $match);
$this->assertNotEmpty($output, "The help hook should return output $context.");
Expand Down
5 changes: 1 addition & 4 deletions trpcultivate_phenocollect/trpcultivate_phenocollect.module
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ function trpcultivate_phenocollect_help($route_name, RouteMatchInterface $route_
case 'help.page.trpcultivate_phenocollect':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';

$output .= '<ul>'
. '<li>' . t('Provides tools to backup and upload phenotypic data while it is being collected in a access controlled environment.') . '</li>'
. '</ul>';
$output .= '<ul><li>' . t('Provides tools to backup and upload phenotypic data while it is being collected in an access controlled environment.') . '</li></ul>';

return $output;

Expand Down
Loading

0 comments on commit 5f8f15e

Please sign in to comment.