Skip to content

Commit 76a08fb

Browse files
committed
Add option --scss-deprecations for behat
1 parent fb9a165 commit 76a08fb

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
moodle-plugin-ci phpdoc
153153
moodle-plugin-ci phpunit --verbose --coverage-text --fail-on-warning
154154
moodle-plugin-ci behat --profile default
155-
moodle-plugin-ci behat --profile chrome
155+
moodle-plugin-ci behat --profile chrome --scss-deprecations
156156
moodle-plugin-ci behat --profile firefox --tags="@local_ci&&~@app"
157157
158158
buildphar:
@@ -279,7 +279,7 @@ jobs:
279279
php build/moodle-plugin-ci.phar phpdoc
280280
php build/moodle-plugin-ci.phar phpunit --verbose --coverage-text --fail-on-warning
281281
php build/moodle-plugin-ci.phar behat --profile default
282-
php build/moodle-plugin-ci.phar behat --profile chrome
282+
php build/moodle-plugin-ci.phar behat --profile chrome --scss-deprecations
283283
php build/moodle-plugin-ci.phar behat --profile firefox --tags="@local_ci&&~@app"
284284
285285
selfupdatetest:

docs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).
88

99
The format of this change log follows the advice given at [Keep a CHANGELOG](https://keepachangelog.com).
1010

11+
## [Unreleased]
12+
### Added
13+
- Allow to run with PHP 8.4 (supported in Moodle 5.0)
14+
- New `--scss-deprecations` option added to the `behat` command
15+
1116
## [4.5.6] - 2025-01-31
1217
### Fixed
1318
- Removed the PHPUnit --verbose option to comply with Moodle 5.0

docs/CLI.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ Print contents of Behat failure HTML files
347347
* Is negatable: no
348348
* Default: `false`
349349

350+
#### `--scss-deprecations`
351+
352+
Enable SCSS deprecation checks
353+
354+
* Accept value: no
355+
* Is value required: no
356+
* Is multiple: no
357+
* Is negatable: no
358+
* Default: `false`
359+
350360
#### `--help|-h`
351361

352362
Display help for the given command. When no command is given display help for the list command

gha.dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
- name: Behat features
107107
id: behat
108108
if: ${{ !cancelled() }}
109-
run: moodle-plugin-ci behat --profile chrome
109+
run: moodle-plugin-ci behat --profile chrome --scss-deprecations
110110

111111
- name: Upload Behat Faildump
112112
if: ${{ failure() && steps.behat.outcome == 'failure' }}

src/Command/BehatCommand.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ protected function configure(): void
4848
->addOption('auto-rerun', null, InputOption::VALUE_REQUIRED, 'Number of times to rerun failures', 2)
4949
->addOption('selenium', null, InputOption::VALUE_REQUIRED, 'Selenium Docker image')
5050
->addOption('dump', null, InputOption::VALUE_NONE, 'Print contents of Behat failure HTML files')
51+
->addOption('scss-deprecations', null, InputOption::VALUE_NONE, 'Enable SCSS deprecation checks')
5152
->setDescription('Run Behat on a plugin');
5253
}
5354

@@ -72,6 +73,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7273

7374
$servers && $this->startServerProcesses($input);
7475

76+
if ($input->getOption('scss-deprecations')) {
77+
$enableprocess = new Process([
78+
'php', 'admin/tool/behat/cli/util_single_run.php',
79+
'--enable',
80+
'--add-core-features-to-theme',
81+
'--scss-deprecations',
82+
], $this->moodle->directory, null, null, null);
83+
$this->execute->passThroughProcess($enableprocess);
84+
}
85+
7586
$cmd = [
7687
'php', 'admin/tool/behat/cli/run.php',
7788
'--profile=' . $input->getOption('profile'),

tests/Command/BehatCommandTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ public function testExecuteWithName()
127127
$this->assertMatchesRegularExpression("/{$expectedName}/", $this->lastCmd);
128128
}
129129

130+
public function testExecuteWithScssDeprecations()
131+
{
132+
$commandTester = $this->executeCommand(null, null, ['--scss-deprecations' => true]);
133+
$this->assertSame(0, $commandTester->getStatusCode());
134+
$this->assertMatchesRegularExpression('/--scss-deprecations/', $this->allCmds[0]);
135+
}
136+
130137
public function testExecuteNoFeatures()
131138
{
132139
$this->fs->remove($this->pluginDir . '/tests/behat');

0 commit comments

Comments
 (0)