forked from tripal/tripal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.x' into tv4g2-issue1758-chado_custom_table_functionality
- Loading branch information
Showing
20 changed files
with
429 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: PHPUnit | ||
on: | ||
push: | ||
branches: | ||
- 4.x | ||
jobs: | ||
running-tests: | ||
name: "Drupal 10.2: PHP 8.1" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Run Automated testing | ||
uses: tripal/[email protected] | ||
with: | ||
directory-name: 'tripal' | ||
modules: 'tripal tripal_biodb tripal_chado' | ||
php-version: '8.1' | ||
pgsql-version: '13' | ||
drupal-version: '10.2.x-dev' | ||
build-image: true | ||
dockerfile: "UseTripalDockerBackupClause" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: PHPUnit | ||
on: | ||
push: | ||
branches: | ||
- 4.x | ||
jobs: | ||
running-tests: | ||
name: "Drupal 10.2: PHP 8.2" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Run Automated testing | ||
uses: tripal/[email protected] | ||
with: | ||
directory-name: 'tripal' | ||
modules: 'tripal tripal_biodb tripal_chado' | ||
php-version: '8.2' | ||
pgsql-version: '13' | ||
drupal-version: '10.2.x-dev' | ||
build-image: true | ||
dockerfile: "UseTripalDockerBackupClause" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: PHPUnit | ||
on: | ||
push: | ||
branches: | ||
- 4.x | ||
jobs: | ||
running-tests: | ||
name: "Drupal 10.2: PHP 8.3" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Run Automated testing | ||
uses: tripal/[email protected] | ||
with: | ||
directory-name: 'tripal' | ||
modules: 'tripal tripal_biodb tripal_chado' | ||
php-version: '8.3' | ||
pgsql-version: '13' | ||
drupal-version: '10.2.x-dev' | ||
build-image: true | ||
dockerfile: "UseTripalDockerBackupClause" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
tripal_chado/tests/src/Functional/Permissions/TripalChadoRoutePermissionsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\tripal\Functional; | ||
|
||
use Drupal\Tests\BrowserTestBase; | ||
use Drupal\file\Entity\File; | ||
use Drupal\user\Entity\Role; | ||
use Drupal\Core\Url; | ||
|
||
/** | ||
* Tests the basic functions of the TripalTerm Entity Type. | ||
* | ||
* @group Tripal | ||
* @group Tripal Chado | ||
* @group Tripal Chado Permissions | ||
*/ | ||
class TripalChadoRoutePermissionsTest extends BrowserTestBase { | ||
|
||
protected $defaultTheme = 'stark'; | ||
|
||
protected static $modules = ['tripal', 'tripal_chado']; | ||
|
||
/** | ||
* Test all the base Tripal Chado admin paths. | ||
* | ||
*/ | ||
public function testTripalChadoAdminPages() { | ||
$session = $this->getSession(); | ||
|
||
// The URLs to check with the key being the label expected in the | ||
// Tripal admin menu listing. | ||
$urls = [ | ||
'Data Loaders' => 'admin/tripal/loaders', | ||
'Data Storage' => 'admin/tripal/storage', | ||
]; | ||
|
||
$userAuthenticatedOnly = $this->drupalCreateUser(); | ||
// Drupal 10.2 tightens permissions, second permission is needed to access importers | ||
$userTripalAdmin = $this->drupalCreateUser(['administer tripal', 'allow tripal import']); | ||
|
||
// First check all the URLs with no user logged in. | ||
// This checks the anonymous user cannot access these pages. | ||
foreach ($urls as $title => $path) { | ||
$html = $this->drupalGet($path); | ||
$status_code = $session->getStatusCode(); | ||
$this->assertEquals(403, $status_code, "The anonymous user should not be able to access this admin page: $title."); | ||
} | ||
|
||
// Next check all the URLs with the authenticated, unprivileged user. | ||
// This checks generic authenticated users cannot access these pages. | ||
$this->drupalLogin($userAuthenticatedOnly); | ||
$this->assertFalse($userAuthenticatedOnly->hasPermission('administer tripal'), "The unprivileged user should not have the 'administer tripal' permission."); | ||
foreach ($urls as $title => $path) { | ||
$html = $this->drupalGet($path); | ||
$status_code = $session->getStatusCode(); | ||
$this->assertEquals(403, $status_code, "The unprivileged user should not be able to access this admin page: $title."); | ||
} | ||
|
||
// Finally check all URLs with the authenticated, privileged user. | ||
// This checks privileged users can access these pages. | ||
$this->drupalLogin($userTripalAdmin); | ||
$this->assertTrue($this->drupalUserIsLoggedIn($userTripalAdmin), "The privileged user should be logged in."); | ||
$this->assertTrue($userTripalAdmin->hasPermission('administer tripal'), "The privileged user should have the 'administer tripal' permission."); | ||
foreach ($urls as $title => $path) { | ||
$html = $this->drupalGet($path); | ||
$status_code = $session->getStatusCode(); | ||
$this->assertEquals(200, $status_code, "The privileged user should be able to access this admin page: $title which should be at '$path'."); | ||
} | ||
|
||
// Test that the Tripal admin menu includes the above links. | ||
// We use try/catch here because WebAssert throws exceptions which are not very readable. | ||
$assert = $this->assertSession(); | ||
$html = $this->drupalGet('admin/tripal'); | ||
unset($urls['Tripal']); | ||
foreach ($urls as $label => $path) { | ||
// -- Find links with the label. | ||
try { | ||
$assert->linkExists($label, 0); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(FALSE, "The '$label' link should exist in the Tripal admin listing."); | ||
} | ||
|
||
// -- Find links with the URL/path. | ||
try { | ||
$assert->linkByHrefExists($path, 0); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(FALSE, "The '$path' link should exist in the Tripal admin listing."); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.