Skip to content

Commit

Permalink
Merge pull request #17 from TripalCultivate/g0.16-drupal10.2Compatibi…
Browse files Browse the repository at this point in the history
…lity

Support added to ensure compatibility with Drupal 10.2 + PHP 8.3
  • Loading branch information
laceysanderson authored Apr 10, 2024
2 parents 6cbc63b + e4c82e9 commit 7af90a5
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 7af90a5

Please sign in to comment.