Skip to content
Merged
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"wp-test-php": [
"@wp-test-ensure-env @no_additional_args",
"@wp-test-remove-database @no_additional_args",
"cd wordpress && node tools/local-env/scripts/docker.js run --rm php php -d opcache.enable_cli=1 -d opcache.memory_consumption=256 -d opcache.jit=tracing -d opcache.jit_buffer_size=64M ./vendor/bin/phpunit @additional_args"
"cd wordpress && node tools/local-env/scripts/docker.js run --rm php php -d zend.enable_gc=0 -d opcache.enable_cli=1 -d opcache.memory_consumption=256 -d opcache.jit=tracing -d opcache.jit_buffer_size=64M ./vendor/bin/phpunit @additional_args"
],
"wp-test-sqlite-plugin-php": [
"@wp-test-php /var/www/tests-sqlite-database-integration/phpunit"
Expand Down
20 changes: 17 additions & 3 deletions wp-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,29 @@ sed -i.bak "s#{SQLITE_PLUGIN}#sqlite-database-integration/load.php#g" "$WP_DIR"/
echo "Rewriting helper class 'WpdbExposedMethodsForTesting' to extend WP_SQLite_DB..."
sed -i.bak "s#class WpdbExposedMethodsForTesting extends wpdb {#class WpdbExposedMethodsForTesting extends WP_SQLite_DB {#g" "$WP_DIR"/tests/phpunit/includes/utils.php

# 6. Make wp-config.php changes immediately visible to E2E tests.
# 6. Use the low bcrypt cost of the test suite in class fixtures as well.
# WP_UnitTestCase::set_up() sets it for each test, which is too late for wpSetUpBeforeClass().
echo "Lowering the bcrypt cost for test fixtures..."
cat << 'EOF' >> "$WP_DIR/tests/phpunit/includes/functions.php"

function _sqlite_tests_lower_bcrypt_cost( $options, $algorithm ) {
if ( PASSWORD_BCRYPT === $algorithm ) {
$options['cost'] = 5;
}
return $options;
}
tests_add_filter( 'wp_hash_password_options', '_sqlite_tests_lower_bcrypt_cost', 1, 2 );
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
EOF

# 7. Make wp-config.php changes immediately visible to E2E tests.
echo "Disabling the PHP OPcache revalidation delay..."
printf '\nopcache.revalidate_freq = 0\n' >> "$WP_DIR/tools/local-env/php-config.ini"

# 7. Create the ".env" file early, so that Docker commands before "env:start" use it too.
# 8. Create the ".env" file early, so that Docker commands before "env:start" use it too.
echo "Creating the '.env' file..."
cp "$WP_DIR/.env.example" "$WP_DIR/.env"

# 8. Install dependencies.
# 9. Install dependencies.
echo "Installing dependencies..."
npm --prefix "$WP_DIR" install
npm --prefix "$WP_DIR" run build:dev
Loading