Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ chmod +x ~/wp-cli/wp
WP_CLI_BIN_DIR=~/wp-cli composer behat
```

#### Project configuration trust

WP-CLI asks for confirmation before acting on `require`, `exec`, `env` or `ssh-args` directives found in a project-level `wp-cli.yml` file. Test fixtures create such files all the time and a test run cannot answer an interactive prompt, so the Behat context passes `WP_CLI_TRUST_PROJECT_CONFIG=1` to every command it runs.

Set the `WP_CLI_TRUST_PROJECT_CONFIG` environment variable yourself to override that default for the whole run. Individual scenarios can override it per command:
```
When I try `WP_CLI_TRUST_PROJECT_CONFIG=false wp cli version`
```
Comment on lines +150 to +157

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the Markdown lint issues in the new section.

Line 150 must use the configured setext heading style. Line 155 must specify a fence language, such as gherkin.

Proposed fix
-#### Project configuration trust
+Project configuration trust
+---------------------------

...

-```
+```gherkin
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### Project configuration trust
WP-CLI asks for confirmation before acting on `require`, `exec`, `env` or `ssh-args` directives found in a project-level `wp-cli.yml` file. Test fixtures create such files all the time and a test run cannot answer an interactive prompt, so the Behat context passes `WP_CLI_TRUST_PROJECT_CONFIG=1` to every command it runs.
Set the `WP_CLI_TRUST_PROJECT_CONFIG` environment variable yourself to override that default for the whole run. Individual scenarios can override it per command:
```
When I try `WP_CLI_TRUST_PROJECT_CONFIG=false wp cli version`
```
Project configuration trust
---------------------------
WP-CLI asks for confirmation before acting on `require`, `exec`, `env` or `ssh-args` directives found in a project-level `wp-cli.yml` file. Test fixtures create such files all the time and a test run cannot answer an interactive prompt, so the Behat context passes `WP_CLI_TRUST_PROJECT_CONFIG=1` to every command it runs.
Set the `WP_CLI_TRUST_PROJECT_CONFIG` environment variable yourself to override that default for the whole run. Individual scenarios can override it per command:
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 150-150: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


[warning] 155-155: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 150 - 157, Update the “Project configuration trust”
heading in README.md to use the repository’s configured setext heading style,
and add a gherkin language identifier to the command example’s fenced code
block.

Source: Linters/SAST tools


### Setting up the tests in Travis CI

Basic rules for setting up the test framework with Travis CI:
Expand Down
8 changes: 8 additions & 0 deletions src/Context/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ private static function get_process_env_variables(): array {
$env['WP_CLI_REQUIRE'] = $updated;
}

// Test fixtures routinely create project-level `wp-cli.yml` files that contain
// `require`, `exec`, `env` or `ssh-args` directives. WP-CLI gates those behind a
// trust confirmation, which cannot be answered in a non-interactive test run, so
// trust them by default. Scenarios that specifically test the trust mechanism can
// still override this by prefixing their command with their own value.
$trust_project_config = getenv( 'WP_CLI_TRUST_PROJECT_CONFIG' );
$env['WP_CLI_TRUST_PROJECT_CONFIG'] = false !== $trust_project_config ? $trust_project_config : '1';

$config_path = getenv( 'WP_CLI_CONFIG_PATH' );
if ( false !== $config_path ) {
$env['WP_CLI_CONFIG_PATH'] = $config_path;
Expand Down
Loading