-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
146 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,12 @@ | ||
--- | ||
name: PHPUnit Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
composer_prereqs: | ||
required: false | ||
type: string | ||
composer_patches: | ||
required: false | ||
type: string | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
PHPUnit: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
drupal-version: ['9.4'] | ||
php-version: ['7.4', '8.0'] | ||
experimental: [false] | ||
include: | ||
- drupal-version: '9' | ||
php-version: '7.4' | ||
experimental: true | ||
- drupal-version: '9' | ||
php-version: '8.1' | ||
experimental: true | ||
- drupal-version: '9.4' | ||
php-version: '8.1' | ||
experimental: true | ||
continue-on-error: ${{ matrix.experimental }} | ||
container: | ||
image: drupal:${{ matrix.drupal-version }}-php${{ matrix.php-version }} | ||
ports: | ||
- 80 | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_DB: drupal | ||
POSTGRES_USER: drupal | ||
POSTGRES_PASSWORD: drupal | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Run PHPUnit Action | ||
uses: discoverygarden/phpunit-action@v1 | ||
with: | ||
composer_package_prerequisites: ${{ inputs.composer_prereqs }} | ||
composer_patches: ${{ inputs.composer_patches }} | ||
composer-auth: ${{ secrets.PRIVATE_PACKAGIST_AUTH_ACCESS }} | ||
uses: discoverygarden/phpunit-action/.github/workflows/phpunit.yml@v1 | ||
secrets: inherit |
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 |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# islandora_entity_status | ||
# Islandora Entity Status | ||
## Introduction | ||
|
||
Cascades entity status to all referenced entities in an Islandora repository item | ||
|
||
## Requirements | ||
|
||
This module requires the following modules/libraries: | ||
|
||
* [Islandora](https://github.com/Islandora/islandora) | ||
|
||
## Installation | ||
|
||
Install as usual, see | ||
[this]( https://www.drupal.org/docs/extending-drupal/installing-modules) for | ||
further information. | ||
|
||
## Troubleshooting/Issues | ||
|
||
Having problems or solved a problem? Contact [discoverygarden](http://support.discoverygarden.ca). | ||
|
||
## Maintainers/Sponsors | ||
|
||
This project has been sponsored by: | ||
|
||
* [discoverygarden](http://wwww.discoverygarden.ca) | ||
|
||
## Development | ||
|
||
If you would like to contribute to this module, please check out our helpful | ||
[Documentation for Developers](https://github.com/Islandora/islandora/wiki#wiki-documentation-for-developers) | ||
info, [Developers](http://islandora.ca/developers) section on Islandora.ca and | ||
contact [discoverygarden](http://support.discoverygarden.ca). | ||
|
||
## License | ||
|
||
[GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt) |
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
"require-dev": { | ||
"discoverygarden/islandora_test_support": "^1" | ||
} | ||
} | ||
} |
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,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit bootstrap="/var/www/html/web/core/tests/bootstrap.php" colors="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutChangesToGlobalState="true" | ||
failOnWarning="true" | ||
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" | ||
cacheResult="false"> | ||
<php> | ||
<!-- Set error reporting to E_ALL. --> | ||
<ini name="error_reporting" value="32767"/> | ||
<!-- Do not limit the amount of memory tests take to run. --> | ||
<ini name="memory_limit" value="-1"/> | ||
<!-- Example SIMPLETEST_BASE_URL value: http://localhost --> | ||
<env name="SIMPLETEST_BASE_URL" value="http://localhost"/> | ||
<!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix --> | ||
<env name="SIMPLETEST_DB" value="pgsql://db:db@db:5432/db"/> | ||
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output --> | ||
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/> | ||
<!-- To have browsertest output use an alternative base URL. For example if | ||
SIMPLETEST_BASE_URL is an internal DDEV URL, you can set this to the | ||
external DDev URL so you can follow the links directly. | ||
--> | ||
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/> | ||
<!-- To disable deprecation testing completely uncomment the next line. --> | ||
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> --> | ||
<!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' --> | ||
<env name="MINK_DRIVER_CLASS" value=''/> | ||
<!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' --> | ||
<env name="MINK_DRIVER_ARGS" value=''/> | ||
<!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" --> | ||
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value=''/> | ||
</php> | ||
<testsuites> | ||
<testsuite name="islandora_entity_status"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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,62 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\islandora_entity_status\Kernel; | ||
|
||
use Drupal\node\NodeInterface; | ||
use Drupal\Tests\islandora_test_support\Kernel\AbstractIslandoraKernelTestBase; | ||
|
||
/** | ||
* Test Islandora Entity status. | ||
* | ||
* @group islandora_entity_status | ||
*/ | ||
class IslandoraEntityStatusTest extends AbstractIslandoraKernelTestBase { | ||
|
||
/** | ||
* Modules to install. | ||
* | ||
* @var array | ||
*/ | ||
protected static $modules = ['islandora_entity_status']; | ||
|
||
/** | ||
* Test that derivatives created on an unpublished node are unpublished. | ||
* | ||
* @throws \Drupal\Core\Entity\EntityStorageException | ||
*/ | ||
public function testDerivativeUnpublishedStatus() { | ||
// Create node. | ||
$node = $this->createNode(); | ||
|
||
// Set node status as unpublished. | ||
$node->setUnpublished(); | ||
$node->save(); | ||
|
||
// Create derivative. | ||
$unpublishedDerivative = $this->createMedia($this->createFile(), $node); | ||
|
||
// Test derivative status. It should be unpublished. | ||
$this->assertSame(NodeInterface::NOT_PUBLISHED, intval($unpublishedDerivative->status->value)); | ||
} | ||
|
||
/** | ||
* Test that derivatives created on a published node are published. | ||
* | ||
* @throws \Drupal\Core\Entity\EntityStorageException | ||
*/ | ||
public function testDerivativePublishedStatus() { | ||
// Create node. | ||
$node = $this->createNode(); | ||
|
||
// Set node status as published. | ||
$node->setPublished(); | ||
$node->save(); | ||
|
||
// Create new derivative. | ||
$publishedDerivative = $this->createMedia($this->createFile(), $node); | ||
|
||
// Check derivative status. It should be published. | ||
$this->assertSame(NodeInterface::PUBLISHED, intval($publishedDerivative->status->value)); | ||
} | ||
|
||
} |