-
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.
Staging some CI tests as example (#108)
* Staging some CI tests as example
- Loading branch information
1 parent
227693c
commit 6275833
Showing
5 changed files
with
113 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: RachelNorfolk Custom Modules | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
extensions: gdate, dom, filter, gd, hash, json, pcre, PDO, session, SimpleXML, SPL, tokenizer, xml | ||
|
||
- name: Composer Install | ||
run: | | ||
composer --no-interaction --no-progress --optimize-autoloader install | ||
- name: Webserver | ||
run: | | ||
nohup php -S 0.0.0.0:8000 -t web > phpd.log 2>&1 & | ||
sed -i "s/\/localhost/\/localhost:8000/g" phpunit.xml | ||
- name: PHPUnit Tests | ||
run: | | ||
./vendor/bin/phpunit web/modules/custom | ||
- name: Check Drupal Coding Standards | ||
run: | | ||
./vendor/bin/phpcs web/modules/custom | ||
- name: Drupal Rector | ||
run: | | ||
composer require --dev palantirnet/drupal-rector | ||
cp vendor/palantirnet/drupal-rector/rector.php . | ||
./vendor/bin/rector process web/modules/custom --dry-run |
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,15 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Listen for Xdebug", | ||
"type": "php", | ||
"request": "launch", | ||
"hostname": "0.0.0.0", | ||
"port": 9003, | ||
"pathMappings": { | ||
"/var/www/html": "${workspaceFolder}" | ||
} | ||
} | ||
] | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="phpcs"> | ||
<description>PHP Code Sniffer configuration</description> | ||
<file>./web/modules/custom</file> | ||
<arg name="extensions" | ||
value="php, | ||
module, | ||
inc, | ||
install, | ||
test, | ||
profile, | ||
theme, | ||
css, | ||
info, | ||
txt, | ||
md, | ||
yml" /> | ||
<config name="drupal_core_version" | ||
value="10" /> | ||
<rule ref="vendor/drupal/coder/coder_sniffer/Drupal" /> | ||
<rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice"/> | ||
</ruleset> |
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
web/modules/custom/dark_mode/tests/src/Functional/DarkModeEnabledTest.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,36 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\dark_mode\Functional; | ||
|
||
use Drupal\Tests\BrowserTestBase; | ||
|
||
/** | ||
* Check that we are actually putting the css on the page. | ||
* | ||
* @group dark_mode | ||
*/ | ||
final class DarkModeEnabledTest extends BrowserTestBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $defaultTheme = 'olivero'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected static $modules = ['dark_mode']; | ||
|
||
/** | ||
* Test callback. | ||
*/ | ||
public function testLibraryLoaded(): void { | ||
$this->drupalGet('/'); | ||
$this->assertSession()->statusCodeEquals(200); | ||
|
||
// Should contain the dark mode css but not that for grey pride. | ||
$this->assertSession()->responseContains('dark_mode/css/dark-mode.css'); | ||
$this->assertSession()->responseNotContains('dark_mode/css/grey-pride.css'); | ||
} | ||
|
||
} |