Skip to content

Commit

Permalink
Merge pull request #640 from lucatume/35-base
Browse files Browse the repository at this point in the history
3.5 base work
  • Loading branch information
lucatume authored Nov 24, 2023
2 parents 3ae45fa + 262d978 commit 3189538
Show file tree
Hide file tree
Showing 163 changed files with 6,621 additions and 772 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
/todo.txt export-ignore
/var export-ignore
/vendor export-ignore

*.php diff=php
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased] Unreleased

### Fixed

- Correctly activate themes during bootstrap.

#### Changed

- Lay the groundwork for version 3.5 automated building.

## [4.0.10] 2023-10-14;

### Added
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,13 @@ clean_procs:
pgrep -f 'php -S' | xargs kill
pgrep chromedriver | xargs kill
rm -f var/_output/*.pid var/_output/*.running
set -o allexport && source tests/.env && set +o allexport && docker compose down
.PHONY: clean_procs

build_35:
rm -rf vendor composer.lock
composer require --dev rector/rector -W
vendor/bin/rector --config=config/rector-35.php
rm -rf vendor composer.lock composer.json
cp config/composer-35.json composer.json
.PHONY: build_35
6 changes: 6 additions & 0 deletions bin/setup-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
$installation->runWpCliCommandOrThrow(['theme', 'install', 'twentytwenty', '--activate']);
}

echo "Checking TwentyTwentyOne theme in $wpRootDir ...\n";
if (!is_dir($wpRootDir . '/wp-content/themes/twentytwentyone')) {
echo "Installing TwentyTwentyOne theme in $wpRootDir ...\n";
$installation->runWpCliCommandOrThrow(['theme', 'install', 'twentytwentyone', '--activate']);
}

echo "Installing required test plugins in $wpRootDir ...\n";
$installation->runWpCliCommandOrThrow(['plugin', 'install', 'woocommerce', 'akismet', 'hello-dolly']);

Expand Down
3 changes: 3 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ extensions:
- "lucatume\\WPBrowser\\Command\\DevInfo"
- "lucatume\\WPBrowser\\Command\\DbImport"
- "lucatume\\WPBrowser\\Command\\DbExport"
snapshot:
refresh: true
version: "%WPBROWSER_VERSION%"
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"require": {
"php": "^8.0",
"ext-pdo": "*",
"ext-mysqli": "*",
"ext-fileinfo": "*",
"ext-json": "*",
"ext-curl": "*",
Expand All @@ -39,13 +40,14 @@
"ifsnop/mysqldump-php": "^2.12"
},
"require-dev": {
"ext-mysqli": "*",
"lucatume/codeception-snapshot-assertions": "^1.0.0",
"gumlet/php-image-resize": "^1.6",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpstan/phpstan": "*",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-symfony": "^1.3",
"squizlabs/php_codesniffer": "^3.7"
"squizlabs/php_codesniffer": "^3.7",
"rector/rector": "^0.18.5"
},
"autoload": {
"psr-4": {
Expand All @@ -58,12 +60,14 @@
},
"files": [
"src/version-4-aliases.php",
"src/Deprecated/deprecated-functions.php"
"src/Deprecated/deprecated-functions.php",
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
"lucatume\\WPBrowser\\Tests\\": "tests/_support"
"lucatume\\WPBrowser\\Tests\\": "tests/_support",
"lucatume\\Rector\\": "config/rector/src"
}
},
"extra": {
Expand Down
101 changes: 101 additions & 0 deletions config/composer-35.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "lucatume/wp-browser",
"type": "library",
"description": "A set of Codeception modules to test WordPress projects.",
"keywords": [
"wordpress",
"codeception"
],
"homepage": "https://github.com/lucatume/wp-browser",
"license": "MIT",
"authors": [
{
"name": "theAverageDev (Luca Tumedei)",
"email": "luca@theaveragedev.com",
"homepage": "https://theaveragedev.com",
"role": "Developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.1 <8.0",
"ext-pdo": "*",
"ext-mysqli": "*",
"ext-fileinfo": "*",
"ext-json": "*",
"ext-curl": "*",
"ext-zip": "*",
"composer-runtime-api": "^2.2",
"codeception/codeception": "^4",
"codeception/module-asserts": "^1.0",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-webdriver": "^1.0",
"codeception/module-db": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-cli": "^1.0",
"symfony/process": ">=3.4.47 <7.0",
"symfony/filesystem": ">=3.4.47 <7.0",
"vlucas/phpdotenv": "^4.3",
"ifsnop/mysqldump-php": "^2.12"
},
"require-dev": {
"gumlet/php-image-resize": "^1.6",
"szepeviktor/phpstan-wordpress": "^0.7",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-symfony": "^0.12.44",
"squizlabs/php_codesniffer": "^3.7",
"lucatume/codeception-snapshot-assertions": "^0.4"
},
"autoload": {
"psr-4": {
"lucatume\\WPBrowser\\": [
"src/",
"src/Deprecated"
],
"Hautelook\\Phpass\\": "includes/Hautelook/Phpass",
"lucatume\\WPBrowser\\Opis\\Closure\\" : "includes/opis/closure/src"
},
"files": [
"src/version-4-aliases.php",
"src/Deprecated/deprecated-functions.php",
"src/functions.php",
"src/shim.php"
]
},
"autoload-dev": {
"psr-4": {
"lucatume\\WPBrowser\\Tests\\": "tests/_support"
}
},
"extra": {
"_hash": "484f861f69198089cab0e642f27e5653"
},
"config": {
"platform": {
"php": "7.1"
},
"allow-plugins": {
"phpstan/extension-installer": true,
"webdriver-binary/binary-chromedriver": true
}
},
"scripts": {
"stan": [
"phpstan analyse --memory-limit=4G --no-progress --no-interaction --ansi -c config/phpstan.neon.dist"
],
"stan-pro": [
"phpstan analyse --memory-limit=4G --no-progress --no-interaction --ansi -c config/phpstan.neon.dist --pro --watch"
],
"cs": [
"phpcs --standard=config/phpcs.xml src"
],
"cs-fix": [
"phpcbf --standard=config/phpcs.xml src"
]
},
"suggest": {
"ext-sqlite3": "For SQLite database support.",
"ext-pdo_sqlite": "For SQLite database support."
}
}
56 changes: 0 additions & 56 deletions config/containers/php/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions config/containers/php/bashrc_scripts.sh

This file was deleted.

19 changes: 0 additions & 19 deletions config/containers/php/php.ini

This file was deleted.

9 changes: 0 additions & 9 deletions config/containers/php/xdebug-off.sh

This file was deleted.

9 changes: 0 additions & 9 deletions config/containers/php/xdebug-on.sh

This file was deleted.

85 changes: 85 additions & 0 deletions config/rector-35.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

declare(strict_types=1);

use Codeception\TestInterface;
use lucatume\Rector\RemoveTypeHinting;
use lucatume\Rector\SwapEventDispatcherEventNameParameters;
use Rector\Config\RectorConfig;
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\RenameProperty;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
dirname(__DIR__) . '/includes',
dirname(__DIR__) . '/src',
dirname(__DIR__) . '/tests',
]);

$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'Symfony\Contracts\EventDispatcher\Event' => 'Symfony\Component\EventDispatcher\Event',
'Psr\EventDispatcher\EventDispatcherInterface' => 'Symfony\Component\EventDispatcher\EventDispatcherInterface'
]);
$rectorConfig->ruleWithConfiguration(RenamePropertyRector::class, [
new RenameProperty(
'lucatume\WPBrowser\TestCase\WPTestCase',
'backupStaticAttributesExcludeList',
'backupStaticAttributesBlacklist'
),
new RenameProperty(
'lucatume\WPBrowser\TestCase\WPTestCase',
'backupGlobalsExcludeList',
'backupGlobalsBlacklist'
)
]);
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
new MethodCallRename('PHPUnit\Framework\Assert', 'assertMatchesRegularExpression', 'assertRegExp'),
new MethodCallRename('PHPUnit\Framework\Assert', 'assertDoesNotMatchRegularExpression', 'assertNotRegExp'),
new MethodCallRename('PHPUnit\Framework\Assert', 'assertFileDoesNotExist', 'assertFileNotExists')
]);

$rectorConfig->rule(SwapEventDispatcherEventNameParameters::class);

$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_71]);
$rectorConfig->skip([DowngradeParameterTypeWideningRector::class]);

$rectorConfig->ruleWithConfiguration(RemoveTypeHinting::class, [
'lucatume\WPBrowser\Module\WPDb' => [
'_cleanup' => [
// from: public function _cleanup(string $databaseKey = null, array $databaseConfig = null): void
// to: public function _cleanup($databaseKey = null, $databaseConfig = null)
RemoveTypeHinting::REMOVE_ALL => true
],
'_loadDump' => [
// from: public function _loadDump(string $databaseKey = null, array $databaseConfig = null): void
// public function _loadDump($databaseKey = null, $databaseConfig = null)
RemoveTypeHinting::REMOVE_ALL => true
],
'loadDumpUsingDriver' => [
// from: protected function loadDumpUsingDriver(string $databaseKey): void
// to: protected function loadDumpUsingDriver($databaseKey)
RemoveTypeHinting::REMOVE_ALL => true
]
],
'lucatume\WPBrowser\Module\WPFilesystem' => [
// from: public function _failed(TestInterface $test, Exception $fail): void
// to: public function _failed(TestInterface $test, Exception $fail)
'_failed' => [
RemoveTypeHinting::REMOVE_RETURN_TYPE_HINTING => true,
RemoveTypeHinting::REMOVE_PARAM_TYPE_HINTING => ['fail']
],
// from: public function assertDirectoryExists(string $directory, string $message = ''): void
// to: protected function assertDirectoryExists($directory, $message = '')
'assertDirectoryExists' => [
RemoveTypeHinting::REMOVE_ALL => true
]
]
]);
};
Loading

0 comments on commit 3189538

Please sign in to comment.