Skip to content

Commit

Permalink
Merge branch 'trunk' into 24-03/custom-tests-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Mar 28, 2024
2 parents 67c8bbc + 22c41a6 commit 92ec007
Show file tree
Hide file tree
Showing 22 changed files with 1,540 additions and 570 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ endif
## Run a command inside an alpine PHP 8 CLI image.
## 1. Command to execute, eg: "./vendor/bin/phpcs" 2. Working dir (optional)
define execPhpAlpine
@docker image inspect qit-cli-php-xdebug > /dev/null 2>&1 || docker build --build-arg CI=${CI} -t qit-cli-php-xdebug ./_build/docker/php83
@docker image inspect qit-cli-php-xdebug-pcntl > /dev/null 2>&1 || docker build --build-arg CI=${CI} -t qit-cli-php-xdebug-pcntl ./_build/docker/php83
docker run --rm \
--user $(DOCKER_USER) \
-v "${PWD}:/app" \
-v "${PWD}/_build/docker/php83/ini:/usr/local/etc/php/conf.d/" \
-v "${PWD}/_build/docker/php83/ini/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini" \
--env QIT_HOME=/tmp \
--env PHP_IDE_CONFIG=serverName=qit_cli \
--workdir "$(2:=/)" \
--add-host host.docker.internal:host-gateway \
qit-cli-php-xdebug \
qit-cli-php-xdebug-pcntl \
bash -c "php -d xdebug.start_with_request=$(if $(filter 1,$(DEBUG)),yes,no) -d memory_limit=1G $(1)"
endef

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@

## Documentation

For more detailed information on QIT and how to use it, refer to the [official documentation](https://woocommerce.github.io/qit-documentation/#/).
For more detailed information on QIT and how to use it, refer to the [documentation](https://qit.woo.com/docs/).

## Quality Insights Toolkit (QIT)

Official tool to streamline the testing of plugins and themes, ensuring they meet the high standards of the Woo.com Marketplace.

- **Comprehensive Testing Suite**: Includes various tests to ensure thorough quality checks.
- [Woo E2E Test](https://woocommerce.github.io/qit-documentation/#/test-types/woo-e2e)
- [Woo API Test](https://woocommerce.github.io/qit-documentation/#/test-types/woo-api)
- [Activation Test](https://woocommerce.github.io/qit-documentation/#/test-types/activation)
- [Security Test](https://woocommerce.github.io/qit-documentation/#/test-types/security)
- [PHPStan Test](https://woocommerce.github.io/qit-documentation/#/test-types/phpstan)
- [PHP Compatibility Test](https://woocommerce.github.io/qit-documentation/#/test-types/phpcompatibility)
- [Malware Test](https://woocommerce.github.io/qit-documentation/#/test-types/malware)
- [Woo E2E Test](https://qit.woo.com/docs/test-types/woo-e2e)
- [Woo API Test](https://qit.woo.com/docs/test-types/woo-api)
- [Activation Test](https://qit.woo.com/docs/test-types/activation)
- [Security Test](https://qit.woo.com/docs/test-types/security)
- [PHPStan Test](https://qit.woo.com/docs/test-types/phpstan)
- [PHP Compatibility Test](https://qit.woo.com/docs/test-types/phpcompatibility)
- [Malware Test](https://qit.woo.com/docs/test-types/malware)
- _Performance Tests (Work-in-progress)_
- _Custom E2E Tests (Work-in-progress)_
- **Configurable Environment**: Configurable PHP, WordPress, WooCommerce versions, and more.
Expand Down
5 changes: 4 additions & 1 deletion _build/docker/php83/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ ARG CI

RUN apt-get update \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip
&& docker-php-ext-install zip \
&& docker-php-ext-enable zip \
&& docker-php-ext-install pcntl \
&& docker-php-ext-enable pcntl

# Install Xdebug only if not in CI environment
RUN if [ "$CI" != "true" ]; then \
Expand Down
1 change: 0 additions & 1 deletion _build/docker/php83/ini/xdebug.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
zend_extension=xdebug.so
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003
xdebug.output_dir = /app/_build/docker/php83/xdebug/output
Expand Down
2 changes: 0 additions & 2 deletions _build/docker/php83/ini/zip.ini

This file was deleted.

1 change: 1 addition & 0 deletions _tests/ParallelOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ParallelOutput {
private $headers;
private $processStatus;
private $startTimes;
private $nonJsonOutput;

public function __construct() {
$this->rawOutput = '';
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@
if ( false ) {
eval( $_POST['foo'] );
}


$thisIsASuspiciousLink = 'https://example.com/akismet-guaranteed-spam/';
7 changes: 7 additions & 0 deletions _tests/tests/QITE2ETestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ public function validate_and_normalize( string $file_path, ?callable $callback =
continue;
}

// Ignore containing "Maximum execution time of 30 seconds exceeded in" in E2E.
if ( stripos( $file_path, 'woo-e2e/' ) !== false && stripos( $debug_log['message'], 'Maximum execution time of 30 seconds exceeded in' ) !== false ) {
echo "Removing 'Maximum execution time of 30 seconds exceeded in' from debug_log.message\n";
unset( $value[ $k ] );
continue;
}

/*
* Normalize PHP debug logs captured during test runs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,45 +41,13 @@
},
{
"test_result_json": [
{
"path": "woocommerce-product-feeds\\/suspicious-links.html",
"rule": "Suspicious.Links",
"violations": [
"LINES: \\n0: This a suspicious link: https:...\\n"
],
"tool": "Jetpack Scan"
},
{
"path": "woocommerce-product-feeds\\/suspicious-tempalte.php",
"rule": "Suspicious.Links",
"violations": [
"LINES: \\n2: $link = \'https:\\/\\/example.com\\/a...\\n"
],
"tool": "Jetpack Scan"
},
{
"path": "woocommerce-product-feeds\\/woocommerce-product-feeds.php",
"rule": "php_backdoor_rce_004",
"violations": [
"LINES: \\n8: if ( false ) {\\n9: \\teval( $_POST[\'foo\'] );\\n10: }\\n"
],
"tool": "Jetpack Scan"
},
{
"path": "woocommerce-product-feeds\\/woocommerce-product-feeds.php",
"rule": "php_suspicious_evalGlobals_001",
"violations": [
"LINES: \\n8: if ( false ) {\\n9: \\teval( $_POST[\'foo\'] );\\n10: }\\n"
],
"tool": "Jetpack Scan"
},
{
"path": "woocommerce-product-feeds\\/woocommerce-product-feeds.php",
"rule": "Suspicious.Links",
"violations": [
"LINES: \\n12: $thisIsASuspiciousLink = \'http...\\n"
],
"tool": "Jetpack Scan"
}
]
}
Expand Down
Loading

0 comments on commit 92ec007

Please sign in to comment.