Skip to content

Commit

Permalink
Removed deprecation warnings and fixed failed tests when accessing ad…
Browse files Browse the repository at this point in the history
…min help page at install
  • Loading branch information
carolyncaron committed Apr 8, 2024
1 parent 86a8f6d commit e4c82e9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
12 changes: 8 additions & 4 deletions trpcultivate_germcollection/tests/src/Functional/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ public function testLoad() {
public function testHelp() {
$session = $this->getSession();

$some_extected_text = self::$help_text_excerpt;
$some_expected_text = self::$help_text_excerpt;

// Ensure we have an admin user.
$user = $this->drupalCreateUser(['access administration pages', 'administer modules']);
$permissions = ['access administration pages', 'administer modules'];
if (strncmp(\Drupal::VERSION, '10.2', 4) === 0) {
$permissions[] = 'access help pages';
}
$user = $this->drupalCreateUser($permissions);
$this->drupalLogin($user);

$context = '(modules installed: ' . implode(',', self::$modules) . ')';
Expand All @@ -83,7 +87,7 @@ public function testHelp() {
$hook_name = self::$module_machinename . '_help';
$output = $hook_name($name, $match);
$this->assertNotEmpty($output, "The help hook should return output $context.");
$this->assertStringContainsString($some_extected_text, $output);
$this->assertStringContainsString($some_expected_text, $output);

// Help Page.
$this->drupalGet('admin/help');
Expand All @@ -93,7 +97,7 @@ public function testHelp() {
$this->drupalGet('admin/help/' . self::$module_machinename);
$status_code = $session->getStatusCode();
$this->assertEquals(200, $status_code, "The module help page should be able to load $context.");
$this->assertSession()->pageTextContains($some_extected_text);
$this->assertSession()->pageTextContains($some_expected_text);
}

}
19 changes: 15 additions & 4 deletions trpcultivate_germplasm/tests/src/Functional/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
class InstallTest extends ChadoTestBrowserBase {

protected $defaultTheme = 'stark';

/**
* The service for retreiving a connection with Chado.
*
* @var Drupal\tripal_chado\Database\ChadoConnection
*/
protected $connection;

/**
* Modules to enable.
Expand Down Expand Up @@ -88,10 +95,14 @@ public function testLoad() {
public function testHelp() {
$session = $this->getSession();

$some_extected_text = self::$help_text_excerpt;
$some_expected_text = self::$help_text_excerpt;

// Ensure we have an admin user.
$user = $this->drupalCreateUser(['access administration pages', 'administer modules']);
$permissions = ['access administration pages', 'administer modules'];
if (strncmp(\Drupal::VERSION, '10.2', 4) === 0) {
$permissions[] = 'access help pages';
}
$user = $this->drupalCreateUser($permissions);
$this->drupalLogin($user);

$context = '(modules installed: ' . implode(',', self::$modules) . ')';
Expand All @@ -102,7 +113,7 @@ public function testHelp() {
$hook_name = self::$module_machinename . '_help';
$output = $hook_name($name, $match);
$this->assertNotEmpty($output, "The help hook should return output $context.");
$this->assertStringContainsString($some_extected_text, $output);
$this->assertStringContainsString($some_expected_text, $output);

// Help Page.
$this->drupalGet('admin/help');
Expand All @@ -112,7 +123,7 @@ public function testHelp() {
$this->drupalGet('admin/help/' . self::$module_machinename);
$status_code = $session->getStatusCode();
$this->assertEquals(200, $status_code, "The module help page should be able to load $context.");
$this->assertSession()->pageTextContains($some_extected_text);
$this->assertSession()->pageTextContains($some_expected_text);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class GermplasmAccessionImporterRunTest extends ChadoTestKernelBase {

protected $importer;

protected $config_factory;

protected $connection;

protected $logger;

protected $definitions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class GermplasmAccessionImporterTest extends ChadoTestKernelBase {

protected $importer;

protected $config_factory;

protected $connection;

protected $definitions = [
'test-germplasm-accession' => [
'id' => 'trpcultivate-germplasm-accession',
Expand Down

0 comments on commit e4c82e9

Please sign in to comment.