From a6311867527dbe4294968b1f3636118153b4ff33 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Mon, 9 Dec 2024 16:41:53 +0100 Subject: [PATCH] transpile #769 Transpile fixes and updates from main branch. --- CHANGELOG.md | 4 + .../opis/closure/src/ReflectionClosure.php | 2 +- .../opis/closure/src/SerializableClosure.php | 4 +- .../Symfony/Component/Process/Process.php | 6 +- src/Events/Dispatcher.php | 2 +- src/ManagedProcess/MysqlServer.php | 4 +- src/Module/Support/DbDump.php | 2 +- src/Module/WPBrowserMethods.php | 6 +- src/Module/WPCLI.php | 2 +- src/Module/WPDb.php | 22 ++--- src/Module/WPFilesystem.php | 2 +- src/Module/WPLoader.php | 18 ++-- src/Module/WPLoader/FiltersGroup.php | 4 +- src/Module/WPQueries.php | 6 +- src/MonkeyPatch/FileStreamWrapper.php | 6 +- .../FileContentsReplacementPatcher.php | 2 +- .../Patchers/FileReplacementPatcher.php | 2 +- src/MonkeyPatch/Patchers/PatcherInterface.php | 2 +- src/Process/SerializableThrowable.php | 10 +- src/Process/StderrStream.php | 2 +- src/Process/Worker/Result.php | 2 +- src/Utils/ChromedriverInstaller.php | 10 +- src/Utils/Codeception.php | 4 +- src/Utils/Composer.php | 4 +- src/Utils/Db.php | 4 +- src/Utils/Env.php | 4 +- src/Utils/Filesystem.php | 4 +- src/Utils/MachineInformation.php | 2 +- src/Utils/MonkeyPatch.php | 4 +- src/Utils/Property.php | 2 +- src/Utils/WP.php | 4 +- src/WordPress/CliProcess.php | 4 +- src/WordPress/FileRequests/FileRequest.php | 6 +- src/WordPress/Installation.php | 4 +- .../InstallationState/InstallationChecks.php | 2 +- src/WordPress/InstallationState/Multisite.php | 2 +- src/WordPress/InstallationState/Single.php | 2 +- src/WordPress/WpConfigFileGenerator.php | 2 +- src/deprecated-functions.php | 12 +-- tests/_support/Traits/LoopIsolation.php | 2 +- .../ManagedProcess/PhpBuiltInServerTest.php | 4 +- .../WPLoaderArbitraryPluginLocationTest.php | 95 ++++++++++++++++++- .../WPBrowser/Module/WPLoaderTest.php | 38 ++++---- .../WPBrowser/Module/WPTestCaseStrictTest.php | 2 +- 44 files changed, 214 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0fa5804..a99a599a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] Unreleased +### Fixed + +- Ensure plugin activation is respected indifferent of plugins that might deactivate others during activation. + ## [3.7.10] 2024-11-29; ## Fixed diff --git a/includes/opis/closure/src/ReflectionClosure.php b/includes/opis/closure/src/ReflectionClosure.php index 210dc56a6..2f8d85d52 100644 --- a/includes/opis/closure/src/ReflectionClosure.php +++ b/includes/opis/closure/src/ReflectionClosure.php @@ -40,7 +40,7 @@ class ReflectionClosure extends ReflectionFunction * * @throws \ReflectionException */ - public function __construct(Closure $closure, string $code = null) + public function __construct(Closure $closure, ?string $code = null) { parent::__construct($closure); } diff --git a/includes/opis/closure/src/SerializableClosure.php b/includes/opis/closure/src/SerializableClosure.php index c80482dc6..3ae56a56b 100644 --- a/includes/opis/closure/src/SerializableClosure.php +++ b/includes/opis/closure/src/SerializableClosure.php @@ -321,7 +321,7 @@ public static function getSecurityProvider(): ?ISecurityProvider * * @internal */ - public static function wrapClosures(&$data, SplObjectStorage $storage = null) + public static function wrapClosures(&$data, ?SplObjectStorage $storage = null) { if ($storage === null) { $storage = static::$context->scope; @@ -395,7 +395,7 @@ public static function wrapClosures(&$data, SplObjectStorage $storage = null) * * @internal */ - public static function unwrapClosures(&$data, SplObjectStorage $storage = null) + public static function unwrapClosures(&$data, ?SplObjectStorage $storage = null) { if ($storage === null) { $storage = static::$context->scope; diff --git a/src/Adapters/Symfony/Component/Process/Process.php b/src/Adapters/Symfony/Component/Process/Process.php index 7884eb3b9..8754a5c3b 100644 --- a/src/Adapters/Symfony/Component/Process/Process.php +++ b/src/Adapters/Symfony/Component/Process/Process.php @@ -27,11 +27,11 @@ class Process extends SymfonyProcess */ public function __construct( array $command, - string $cwd = null, - array $env = null, + ?string $cwd = null, + ?array $env = null, $input = null, ?float $timeout = 60, - array $options = null + ?array $options = null ) { parent::__construct($command, $cwd, $env, $input, $timeout, $options); //@phpstan-ignore-line diff --git a/src/Events/Dispatcher.php b/src/Events/Dispatcher.php index 360189f25..f70dd2380 100644 --- a/src/Events/Dispatcher.php +++ b/src/Events/Dispatcher.php @@ -17,7 +17,7 @@ class Dispatcher */ private static $eventDispatcher; - public static function setEventDispatcher(EventDispatcherInterface $eventDispatcher = null): void + public static function setEventDispatcher(?EventDispatcherInterface $eventDispatcher = null): void { $previousEventDispatcher = self::$eventDispatcher; diff --git a/src/ManagedProcess/MysqlServer.php b/src/ManagedProcess/MysqlServer.php index 9a99ee121..b8f08df0f 100644 --- a/src/ManagedProcess/MysqlServer.php +++ b/src/ManagedProcess/MysqlServer.php @@ -85,7 +85,7 @@ class MysqlServer implements ManagedProcessInterface /** * @throws RuntimeException */ - public function __construct(string $directory = null, int $port = self::PORT_DEFAULT, string $database = 'wordpress', string $user = 'wordpress', string $password = 'wordpress', ?string $binary = null, ?string $shareDir = null) + public function __construct(?string $directory = null, int $port = self::PORT_DEFAULT, string $database = 'wordpress', string $user = 'wordpress', string $password = 'wordpress', ?string $binary = null, ?string $shareDir = null) { $this->port = $port; $this->database = $database; @@ -584,7 +584,7 @@ public function isUsingCustomBinary(): bool return $this->usingCustomBinary; } - public function setOutput(OutputInterface $output = null): void + public function setOutput(?OutputInterface $output = null): void { $this->output = $output; } diff --git a/src/Module/Support/DbDump.php b/src/Module/Support/DbDump.php index f5290a55b..8ef9e877e 100644 --- a/src/Module/Support/DbDump.php +++ b/src/Module/Support/DbDump.php @@ -304,7 +304,7 @@ public function getOriginalUrlFromSqlString(string $sql) * @param string|null $originalUrl The site URL that should be replaced in the dump, or `null` to unset the * property. */ - public function setOriginalUrl(string $originalUrl = null): void + public function setOriginalUrl(?string $originalUrl = null): void { if ($originalUrl === null) { $this->originalUrl = null; diff --git a/src/Module/WPBrowserMethods.php b/src/Module/WPBrowserMethods.php index 766215e78..d8c9a2e4c 100644 --- a/src/Module/WPBrowserMethods.php +++ b/src/Module/WPBrowserMethods.php @@ -132,7 +132,7 @@ public function _initialize(): void * * @return FacebookWebdriverCookie|Cookie|null The WordPress authorization cookie or `null` if not found. */ - protected function grabWordPressAuthCookie(string $pattern = null) + protected function grabWordPressAuthCookie(?string $pattern = null) { $pattern = $pattern ?: '/^wordpress_[a-z0-9]{32}$/'; $cookies = $this->grabCookiesWithPattern($pattern); @@ -147,7 +147,7 @@ protected function grabWordPressAuthCookie(string $pattern = null) * * @return FacebookWebdriverCookie|Cookie|null The WordPress login cookie or `null` if not found. */ - protected function grabWordPressLoginCookie(string $pattern = null) + protected function grabWordPressLoginCookie(?string $pattern = null) { $pattern = $pattern ?: '/^wordpress_logged_in_[a-z0-9]{32}$/'; $cookies = $this->grabCookiesWithPattern($pattern); @@ -365,7 +365,7 @@ public function seeMessage($classes = ''): void * * @return Cookie|null Either a cookie object or `null`. */ - public function grabWordPressTestCookie(string $name = null): ?Cookie + public function grabWordPressTestCookie(?string $name = null): ?Cookie { $name = $name ?: 'wordpress_test_cookie'; diff --git a/src/Module/WPCLI.php b/src/Module/WPCLI.php index 8eee19bfd..b4351013b 100644 --- a/src/Module/WPCLI.php +++ b/src/Module/WPCLI.php @@ -286,7 +286,7 @@ public function grabLastShellErrorOutput(): string */ public function cliToArray( array $command, - callable $splitCallback = null, + ?callable $splitCallback = null, ?array $env = null, $input = null ): array { diff --git a/src/Module/WPDb.php b/src/Module/WPDb.php index 2d681d446..84d434c76 100644 --- a/src/Module/WPDb.php +++ b/src/Module/WPDb.php @@ -216,7 +216,7 @@ class WPDb extends Db * * @return void */ - public function __construct(ModuleContainer $moduleContainer, ?array $config = null, DbDump $dbDump = null) + public function __construct(ModuleContainer $moduleContainer, ?array $config = null, ?DbDump $dbDump = null) { parent::__construct($moduleContainer, $config); $this->dbDump = $dbDump ?? new DbDump(); @@ -356,7 +356,7 @@ protected function validateConfig(): void * * @throws ModuleException It the database cannot be correctly initialized. */ - public function _initialize(Tables $table = null): void + public function _initialize(?Tables $table = null): void { /** * Dispatches an event before the WPDb module initializes. @@ -396,7 +396,7 @@ public function _initialize(Tables $table = null): void * * @throws ModuleConfigException|ModuleException If there's an issue during the cleanup phase. */ - public function importSqlDumpFile(string $dumpFile = null): void + public function importSqlDumpFile(?string $dumpFile = null): void { if ($dumpFile !== null) { if (!is_file($dumpFile) || !is_readable($dumpFile)) { @@ -611,8 +611,8 @@ public function dontSeePostMetaInDatabase(array $criteria): void public function seePostWithTermInDatabase( int $post_id, int $term_taxonomy_id, - int $term_order = null, - string $taxonomy = null + ?int $term_order = null, + ?string $taxonomy = null ): void { if ($taxonomy !== null) { $match = $this->grabTermTaxonomyIdFromDatabase([ @@ -3574,7 +3574,7 @@ public function dontSeeBlogInDatabase(array $criteria): void * @param string|null $themeName The theme name, e.g. `Acme`, defaults to the "title" version of * `$stylesheet`. */ - public function useTheme(string $stylesheet, string $template = null, string $themeName = null): void + public function useTheme(string $stylesheet, ?string $template = null, ?string $themeName = null): void { $template = $template ?: $stylesheet; $themeName = $themeName ?: ucwords($stylesheet, ' _'); @@ -3654,7 +3654,7 @@ public function haveMenuInDatabase(string $slug, string $location, array $overri public function haveMenuItemInDatabase( string $menuSlug, string $title, - int $menuOrder = null, + ?int $menuOrder = null, array $meta = [] ): int { if (empty($this->stylesheet)) { @@ -3751,7 +3751,7 @@ public function haveAttachmentInDatabase( string $file, $date = 'now', array $overrides = [], - array $imageSizes = null + ?array $imageSizes = null ): int { if (!class_exists(ImageResize::class)) { $message = 'The "haveAttachmentInDatabase" method requires the "gumlet/php-image-resize:^1.6" package.' . @@ -3902,7 +3902,7 @@ public function haveAttachmentInDatabase( * * @return string The current site URL */ - public function grabSiteUrl(string $path = null): string + public function grabSiteUrl(?string $path = null): string { /** @var array{url: string} $config Validated module config. */ $config = $this->config; @@ -4528,8 +4528,8 @@ public function _loadDump($databaseKey = null, $databaseConfig = null) public function dontSeePostWithTermInDatabase( int $post_id, int $term_taxonomy_id, - int $term_order = null, - string $taxonomy = null + ?int $term_order = null, + ?string $taxonomy = null ): void { if ($taxonomy !== null) { $match = $this->grabTermTaxonomyIdFromDatabase([ diff --git a/src/Module/WPFilesystem.php b/src/Module/WPFilesystem.php index cc6d20a12..ff80741ab 100644 --- a/src/Module/WPFilesystem.php +++ b/src/Module/WPFilesystem.php @@ -501,7 +501,7 @@ public function deleteUploadedFile(string $file, $date = null): void * * @param string|null $dir The path to the directory to delete, relative to the uploads folder. */ - public function cleanUploadsDir(string $dir = null, $date = null): void + public function cleanUploadsDir(?string $dir = null, $date = null): void { $dir = null === $dir ? $this->config['uploads'] : $this->getUploadsPath( $dir, diff --git a/src/Module/WPLoader.php b/src/Module/WPLoader.php index a032f289b..e280701e4 100644 --- a/src/Module/WPLoader.php +++ b/src/Module/WPLoader.php @@ -466,7 +466,7 @@ public function _initialize(): void if (empty($config['dbHost']) && strncmp($config['dbName'], codecept_root_dir(), strlen(codecept_root_dir())) === 0) { $dbFile = (array_reverse(explode(DIRECTORY_SEPARATOR, $config['dbName']))[0]); $dbDir = rtrim(str_replace($dbFile, '', $config['dbName']), DIRECTORY_SEPARATOR); - $db = new SqliteDatabase($dbDir, $dbFile); + $db = new SqliteDatabase($dbDir, $dbFile, $config['tablePrefix']); } else { $db = new MysqlDatabase( $config['dbName'], @@ -590,7 +590,7 @@ public function _beforeSuite($settings = []) * * @return string The absolute path to the WordPress root folder or a path within it. */ - public function getWpRootFolder(string $path = null): string + public function getWpRootFolder(?string $path = null): string { return $this->installation->getWpRootDir($path); } @@ -1171,13 +1171,10 @@ private function activatePluginsTheme(array $plugins): array $database->updateOption('stylesheet', $database->getOption('stylesheet')); } - // Flush the cache to force the refetch of the options' value. - wp_cache_delete('alloptions', 'options'); - // Do not include external plugins, it would create issues at this stage. $pluginsDir = $this->getPluginsFolder(); - return array_values( + $activePlugins = array_values( array_filter( $plugins, static function (string $plugin) use ($pluginsDir) { @@ -1185,6 +1182,15 @@ static function (string $plugin) use ($pluginsDir) { } ) ); + + // During activation some plugins could deactivate other plugins: protect from it. + $database->updateOption('active_plugins', $activePlugins); + + // Flush the cache to force the refetch of the options' value. + wp_cache_delete('alloptions', 'options'); + + + return $activePlugins; } /** diff --git a/src/Module/WPLoader/FiltersGroup.php b/src/Module/WPLoader/FiltersGroup.php index 3e7628a5f..49ebf73ad 100644 --- a/src/Module/WPLoader/FiltersGroup.php +++ b/src/Module/WPLoader/FiltersGroup.php @@ -42,8 +42,8 @@ class FiltersGroup */ public function __construct( array $filters = [], - callable $removeWith = null, - callable $addWith = null + ?callable $removeWith = null, + ?callable $addWith = null ) { /** * An array detailing each filter callback, priority and arguments. diff --git a/src/Module/WPQueries.php b/src/Module/WPQueries.php index 814363099..12582f9ae 100644 --- a/src/Module/WPQueries.php +++ b/src/Module/WPQueries.php @@ -149,7 +149,7 @@ private function readQueries(): void * * @param wpdb|null $wpdb */ - public function _getFilteredQueriesIterator(wpdb $wpdb = null): SetupTearDownQueriesFilter + public function _getFilteredQueriesIterator(?wpdb $wpdb = null): SetupTearDownQueriesFilter { if (null === $wpdb) { $wpdb = $this->_getWpdb(); @@ -1029,7 +1029,7 @@ public function assertQueriesCountByStatementAndFilter( * * @return int The current count of performed queries. */ - public function countQueries(wpdb $wpdb = null): int + public function countQueries(?wpdb $wpdb = null): int { return count($this->getQueries($wpdb)); } @@ -1050,7 +1050,7 @@ public function countQueries(wpdb $wpdb = null): int * * @return array{0: string, 1: float, 2: string, 3: float, 4?: array}[] An array of queries. */ - public function getQueries(wpdb $wpdb = null): array + public function getQueries(?wpdb $wpdb = null): array { /** @var array{0: string, 1: float, 2: string, 3: float, 4?: array}[] $logicQueries */ $logicQueries = iterator_to_array($this->_getFilteredQueriesIterator($wpdb), false); diff --git a/src/MonkeyPatch/FileStreamWrapper.php b/src/MonkeyPatch/FileStreamWrapper.php index b1ab1fced..b3e29d78d 100644 --- a/src/MonkeyPatch/FileStreamWrapper.php +++ b/src/MonkeyPatch/FileStreamWrapper.php @@ -33,7 +33,7 @@ public static function setPatcherForFile( string $file, PatcherInterface $patcher, bool $redirectOpenedPath = true, - string $context = null + ?string $context = null ): void { $fromFilePath = FS::realpath($file) ?: $file; self::$fileToPatcherMap[$fromFilePath] = [$patcher, $redirectOpenedPath, $context ?? '']; @@ -74,7 +74,7 @@ public function __destruct() /** * @throws MonkeyPatchingException */ - public function stream_open(string $path, string $mode, int $options, string &$openedPath = null): bool + public function stream_open(string $path, string $mode, int $options, ?string &$openedPath = null): bool { self::unregister(); @@ -231,7 +231,7 @@ public function rename(string $from, string $to): bool return $result; } - public function rmdir(string $path, int $options = null): bool + public function rmdir(string $path, ?int $options = null): bool { static::unregister(); diff --git a/src/MonkeyPatch/Patchers/FileContentsReplacementPatcher.php b/src/MonkeyPatch/Patchers/FileContentsReplacementPatcher.php index 194b72b17..04b717191 100644 --- a/src/MonkeyPatch/Patchers/FileContentsReplacementPatcher.php +++ b/src/MonkeyPatch/Patchers/FileContentsReplacementPatcher.php @@ -20,7 +20,7 @@ public function __construct(string $fileContents) /** * @throws MonkeyPatchingException */ - public function patch(string $fileContents, string $pathname, string $context = null): array + public function patch(string $fileContents, string $pathname, ?string $context = null): array { $replacementFile = MonkeyPatch::getReplacementFileName($pathname, $context ?? $this->fileContents); diff --git a/src/MonkeyPatch/Patchers/FileReplacementPatcher.php b/src/MonkeyPatch/Patchers/FileReplacementPatcher.php index 1eb2d55a1..c1d2e98e2 100644 --- a/src/MonkeyPatch/Patchers/FileReplacementPatcher.php +++ b/src/MonkeyPatch/Patchers/FileReplacementPatcher.php @@ -18,7 +18,7 @@ public function __construct(string $replacementFile) /** * @throws MonkeyPatchingException */ - public function patch(string $fileContents, string $pathname, string $context = null): array + public function patch(string $fileContents, string $pathname, ?string $context = null): array { $replacementFileContents = file_get_contents($this->replacementFile); diff --git a/src/MonkeyPatch/Patchers/PatcherInterface.php b/src/MonkeyPatch/Patchers/PatcherInterface.php index c33608e8a..aa64e0c98 100644 --- a/src/MonkeyPatch/Patchers/PatcherInterface.php +++ b/src/MonkeyPatch/Patchers/PatcherInterface.php @@ -7,7 +7,7 @@ interface PatcherInterface /** * @return array{string, string} */ - public function patch(string $fileContents, string $pathname, string $context = null): array; + public function patch(string $fileContents, string $pathname, ?string $context = null): array; /** * @return array{ diff --git a/src/Process/SerializableThrowable.php b/src/Process/SerializableThrowable.php index 4737236dd..682aa204c 100644 --- a/src/Process/SerializableThrowable.php +++ b/src/Process/SerializableThrowable.php @@ -28,7 +28,7 @@ class SerializableThrowable */ private $line; /** - * @var int + * @var int|string */ private $code; /** @@ -60,13 +60,13 @@ public function __construct(Throwable $throwable) * colorize: bool, * throwable: Throwable, * message: string, - * code: int, + * code: int|string, * file: string, * line: int, * trace: array> * } */ - public function __serialize(): array // phpcs:ignore + public function __serialize(): array { return [ 'colorize' => $this->colorize, @@ -92,7 +92,7 @@ public function __serialize(): array // phpcs:ignore * * @throws ReflectionException */ - public function __unserialize(array $data): void // phpcs:ignore + public function __unserialize(array $data): void { $this->throwable = $data['throwable']; $this->colorize = $data['colorize']; @@ -133,7 +133,7 @@ private function prettyPrintTrace(array $trace): array $updatedTrace = []; $streamIsatty = function ($stream) { if (\function_exists('stream_isatty')) { - return stream_isatty($stream); // phpcs:ignore + return stream_isatty($stream); } if (!\is_resource($stream)) { trigger_error('stream_isatty() expects parameter 1 to be resource, ' . \gettype($stream) . ' given', \E_USER_WARNING); diff --git a/src/Process/StderrStream.php b/src/Process/StderrStream.php index c9e2d1601..af03195fa 100644 --- a/src/Process/StderrStream.php +++ b/src/Process/StderrStream.php @@ -28,7 +28,7 @@ class StderrStream */ private $currentDatetime; - public function __construct(string $streamContents, int $options = 0, DateTimeInterface $currentDateTime = null) + public function __construct(string $streamContents, int $options = 0, ?DateTimeInterface $currentDateTime = null) { $this->currentDatetime = $currentDateTime ?: new DateTime(); $this->parse($streamContents, $options); diff --git a/src/Process/Worker/Result.php b/src/Process/Worker/Result.php index 898edc37f..c2d6777a3 100644 --- a/src/Process/Worker/Result.php +++ b/src/Process/Worker/Result.php @@ -37,7 +37,7 @@ public function __construct( string $stdoutBuffer = '', string $stderrBuffer = '', $returnValue = null, - int $memoryUsage = null + ?int $memoryUsage = null ) { $this->id = $id; $this->exitCode = $exitCode; diff --git a/src/Utils/ChromedriverInstaller.php b/src/Utils/ChromedriverInstaller.php index bcf3b583b..c880dcfa9 100644 --- a/src/Utils/ChromedriverInstaller.php +++ b/src/Utils/ChromedriverInstaller.php @@ -49,10 +49,10 @@ class ChromedriverInstaller private $useEnvZipFile = true; public function __construct( - string $version = null, - string $platform = null, - string $binary = null, - OutputInterface $output = null + ?string $version = null, + ?string $platform = null, + ?string $binary = null, + ?OutputInterface $output = null ) { $this->output = $output ?? new NullOutput(); @@ -277,7 +277,7 @@ private function checkVersion($version): string /** * @throws JsonException */ - public function install(string $dir = null): string + public function install(?string $dir = null): string { if ($dir === null) { global $_composer_bin_dir; diff --git a/src/Utils/Codeception.php b/src/Utils/Codeception.php index fe5c74587..76d82967b 100644 --- a/src/Utils/Codeception.php +++ b/src/Utils/Codeception.php @@ -6,7 +6,7 @@ class Codeception { - public static function dataDir(string $rootDir = null): string + public static function dataDir(?string $rootDir = null): string { $relDataPath = version_compare(Codecept::VERSION, '5.0.0', '>=') ? implode(DIRECTORY_SEPARATOR, ['tests', 'Support', 'Data']) @@ -16,7 +16,7 @@ public static function dataDir(string $rootDir = null): string : $relDataPath; } - public static function supportDir(string $rootDir = null): string + public static function supportDir(?string $rootDir = null): string { $relSupportPath = version_compare(Codecept::VERSION, '5.0.0', '>=') ? implode(DIRECTORY_SEPARATOR, ['tests', 'Support']) diff --git a/src/Utils/Composer.php b/src/Utils/Composer.php index 1d9ce5ac8..8730b1c80 100644 --- a/src/Utils/Composer.php +++ b/src/Utils/Composer.php @@ -108,7 +108,7 @@ public function requireDev(array $packages): void /** * @throws JsonException */ - public function update(string $package = null): void + public function update(?string $package = null): void { $this->write(); $this->runUpdate($package); @@ -133,7 +133,7 @@ public function write(): int /** * @throws RuntimeException */ - private function runUpdate(string $package = null): void + private function runUpdate(?string $package = null): void { $lockFileExists = file_exists(dirname($this->composerJsonFile) . '/composer.lock'); $command = $package && $lockFileExists ? diff --git a/src/Utils/Db.php b/src/Utils/Db.php index c2b56c47d..224ecb9bf 100644 --- a/src/Utils/Db.php +++ b/src/Utils/Db.php @@ -98,7 +98,7 @@ public static function mysqlBin(): string * * @throws PDOException If the database connection attempt fails. */ - public static function db(string $dsn, string $user, string $pass, string $dbName = null): Closure + public static function db(string $dsn, string $user, string $pass, ?string $dbName = null): Closure { if ($dbName !== null) { // If a dbname is specified, then let's use that and not the one (maybe) specified in the dsn string. @@ -254,7 +254,7 @@ public static function dbDsnMap(string $dbHost): array * @return array{dsn: string, user: string, password: string} The database credentials map: dsn string, user and * password. */ - public static function dbCredentials(array $dsn, string $dbuser, string $dbpass, string $dbname = null): array + public static function dbCredentials(array $dsn, string $dbuser, string $dbpass, ?string $dbname = null): array { $dbname = $dsn['dbname'] ?? $dbname; $dbuser = empty($dbuser) ? 'root' : $dbuser; diff --git a/src/Utils/Env.php b/src/Utils/Env.php index 20e5624a7..0b7e0cad2 100644 --- a/src/Utils/Env.php +++ b/src/Utils/Env.php @@ -81,7 +81,7 @@ static function (array $lines, $line) use ($pattern): array { */ public static function os(): string { - $osSlug = strtolower(substr(PHP_OS, 0, 3)); + $osSlug = strtolower(substr(PHP_OS_FAMILY, 0, 3)); $map = [ 'win' => 'Windows', @@ -131,7 +131,7 @@ public static function loadEnvMap(array $map, bool $overwrite = true): void /** * @return string|false|null */ - public static function get(string $key, string $default = null) + public static function get(string $key, ?string $default = null) { return $_ENV[$key] ?? $_SERVER[$key] ?? (getenv($key) ?: $default); } diff --git a/src/Utils/Filesystem.php b/src/Utils/Filesystem.php index 5f47c04f3..6fa6aa6dd 100644 --- a/src/Utils/Filesystem.php +++ b/src/Utils/Filesystem.php @@ -113,7 +113,7 @@ public static function homeDir(string $path = ''): string * * @throws InvalidArgumentException If the root or path cannot be resolved. */ - public static function resolvePath(string $path, string $root = null) + public static function resolvePath(string $path, ?string $root = null) { $root = $root ?? getcwd(); @@ -328,7 +328,7 @@ public static function tmpDir( string $prefix = '', array $contents = [], int $mode = 0777, - string $tmpRootDir = null + ?string $tmpRootDir = null ): string { if ($tmpRootDir === null) { $tmpRootDir = Env::get('TEST_TMP_ROOT_DIR') ?? codecept_output_dir('tmp'); diff --git a/src/Utils/MachineInformation.php b/src/Utils/MachineInformation.php index 0414cfd1e..4dc628acc 100644 --- a/src/Utils/MachineInformation.php +++ b/src/Utils/MachineInformation.php @@ -22,7 +22,7 @@ class MachineInformation */ private $architecture; - public function __construct(string $operatingSystem = null, string $architecture = null) + public function __construct(?string $operatingSystem = null, ?string $architecture = null) { switch (strtolower(substr(php_uname('s'), 0, 3))) { case 'dar': diff --git a/src/Utils/MonkeyPatch.php b/src/Utils/MonkeyPatch.php index 7d2ba6448..943b8efca 100644 --- a/src/Utils/MonkeyPatch.php +++ b/src/Utils/MonkeyPatch.php @@ -14,7 +14,7 @@ public static function redirectFileToFile( string $fromFile, string $toFile, bool $redirectOpenedPath = true, - string $context = null + ?string $context = null ): void { FileStreamWrapper::setPatcherForFile( $fromFile, @@ -33,7 +33,7 @@ public static function redirectFileContents( string $fromFile, string $fileContents, bool $redirectOpenedPath = true, - string $context = null + ?string $context = null ): void { FileStreamWrapper::setPatcherForFile( $fromFile, diff --git a/src/Utils/Property.php b/src/Utils/Property.php index 0e0cec5c0..014c9ca9d 100644 --- a/src/Utils/Property.php +++ b/src/Utils/Property.php @@ -60,7 +60,7 @@ public static function setPropertiesForClass( $object, string $class, array $props, - array &$propsToSet = null + ?array &$propsToSet = null ) { if (!class_exists($class)) { throw new InvalidArgumentException( diff --git a/src/Utils/WP.php b/src/Utils/WP.php index 4060d562c..e5f8400a7 100644 --- a/src/Utils/WP.php +++ b/src/Utils/WP.php @@ -25,7 +25,7 @@ class WP * * @return array The list of dropped tables. */ - public static function dropWpTables(wpdb $wpdb, array $tables = null): array + public static function dropWpTables(wpdb $wpdb, ?array $tables = null): array { $allTables = $wpdb->tables('all'); $tablesList = $tables !== null ? array_intersect($allTables, $tables) : $allTables; @@ -59,7 +59,7 @@ public static function dropWpTables(wpdb $wpdb, array $tables = null): array * * @return array The list of emptied tables. */ - public static function emptyWpTables(wpdb $wpdb, array $tables = null): array + public static function emptyWpTables(wpdb $wpdb, ?array $tables = null): array { $allTables = $wpdb->tables('all'); $tablesList = $tables !== null ? array_intersect($allTables, $tables) : $allTables; diff --git a/src/WordPress/CliProcess.php b/src/WordPress/CliProcess.php index 4bb550857..bb379475a 100644 --- a/src/WordPress/CliProcess.php +++ b/src/WordPress/CliProcess.php @@ -59,8 +59,8 @@ public function __construct( */ public static function fromShellCommandline( string $command, - string $cwd = null, - array $env = null, + ?string $cwd = null, + ?array $env = null, $input = null, ?float $timeout = 60 ) { diff --git a/src/WordPress/FileRequests/FileRequest.php b/src/WordPress/FileRequests/FileRequest.php index 5b8ea9e33..76931e386 100644 --- a/src/WordPress/FileRequests/FileRequest.php +++ b/src/WordPress/FileRequests/FileRequest.php @@ -103,7 +103,7 @@ public function execute(): array { if (count($this->presetGlobalVars) > 0) { foreach ($this->presetGlobalVars as $key => $value) { - global $$key; // phpcs:ignore + global $$key; $$key = $value; } } @@ -223,7 +223,7 @@ public function execute(): array * targetFile: string * } */ - public function __serialize(): array // phpcs:ignore + public function __serialize(): array { return [ 'afterLoadClosures' => $this->afterLoadClosures, @@ -259,7 +259,7 @@ public function __serialize(): array // phpcs:ignore * * @throws FileRequestException */ - public function __unserialize(array $data): void // phpcs:ignore + public function __unserialize(array $data): void { $this->afterLoadClosures = $data['afterLoadClosures'] ?? []; $this->constants = $data['constants'] ?? []; diff --git a/src/WordPress/Installation.php b/src/WordPress/Installation.php index 5c04a5aaf..1e6c633af 100644 --- a/src/WordPress/Installation.php +++ b/src/WordPress/Installation.php @@ -192,7 +192,7 @@ public static function findInDir(string $searchDir, bool $checkDb = true): self public function configure( DatabaseInterface $db, int $multisite = InstallationStateInterface::SINGLE_SITE, - ConfigurationData $configurationData = null + ?ConfigurationData $configurationData = null ): self { $this->installationState = $this->installationState->configure($db, $multisite, $configurationData); @@ -362,7 +362,7 @@ public function getSalts(): array * * @return array */ - public function report(array $checkKeys = null): array + public function report(?array $checkKeys = null): array { $map = [ 'rootDir' => function () : string { diff --git a/src/WordPress/InstallationState/InstallationChecks.php b/src/WordPress/InstallationState/InstallationChecks.php index 9a289f927..ff1ccf993 100644 --- a/src/WordPress/InstallationState/InstallationChecks.php +++ b/src/WordPress/InstallationState/InstallationChecks.php @@ -23,7 +23,7 @@ trait InstallationChecks * @throws WorkerException * @throws ProcessException */ - protected function isInstalled(bool $multisite, DatabaseInterface $db = null): bool + protected function isInstalled(bool $multisite, ?DatabaseInterface $db = null): bool { if ($db === null && property_exists($this, 'db') && $this->db instanceof DatabaseInterface) { $db = $this->db; diff --git a/src/WordPress/InstallationState/Multisite.php b/src/WordPress/InstallationState/Multisite.php index 904d6255a..b586f3cd3 100644 --- a/src/WordPress/InstallationState/Multisite.php +++ b/src/WordPress/InstallationState/Multisite.php @@ -29,7 +29,7 @@ class Multisite implements InstallationStateInterface * @throws Throwable * @throws WorkerException */ - public function __construct(string $wpRootDir, string $wpConfigFilePath, DatabaseInterface $db = null) + public function __construct(string $wpRootDir, string $wpConfigFilePath, ?DatabaseInterface $db = null) { $this->buildConfigured($wpRootDir, $wpConfigFilePath); diff --git a/src/WordPress/InstallationState/Single.php b/src/WordPress/InstallationState/Single.php index df8da02b5..0a965efea 100644 --- a/src/WordPress/InstallationState/Single.php +++ b/src/WordPress/InstallationState/Single.php @@ -32,7 +32,7 @@ class Single implements InstallationStateInterface * @throws Throwable * @throws WorkerException */ - public function __construct(string $wpRootDir, string $wpConfigFilePath, DatabaseInterface $db = null) + public function __construct(string $wpRootDir, string $wpConfigFilePath, ?DatabaseInterface $db = null) { $this->buildConfigured($wpRootDir, $wpConfigFilePath); diff --git a/src/WordPress/WpConfigFileGenerator.php b/src/WordPress/WpConfigFileGenerator.php index dfdab8d28..afeb162b7 100644 --- a/src/WordPress/WpConfigFileGenerator.php +++ b/src/WordPress/WpConfigFileGenerator.php @@ -23,7 +23,7 @@ class WpConfigFileGenerator /** * @throws InstallationException */ - public function __construct(string $wpRootDir, string $relativePathRoot = null) + public function __construct(string $wpRootDir, ?string $relativePathRoot = null) { if (!is_dir($wpRootDir)) { throw new InstallationException( diff --git a/src/deprecated-functions.php b/src/deprecated-functions.php index 1eec8d05e..f7d091681 100644 --- a/src/deprecated-functions.php +++ b/src/deprecated-functions.php @@ -42,7 +42,7 @@ function mysqlBin(): string /** * @deprecated Use \lucatume\WPBrowser\Utils\MysqlDatabase::db instead. */ - function db(string $dsn, string $user, string $pass, string $dbName = null): callable + function db(string $dsn, string $user, string $pass, ?string $dbName = null): callable { return Db::db($dsn, $user, $pass, $dbName); } @@ -73,7 +73,7 @@ function dbDsnMap(string $dbHost): array * } * @deprecated Use \lucatume\WPBrowser\Utils\MysqlDatabase::dbCredentials instead. */ - function dbCredentials(array $dsn, string $dbuser, string $dbpass, string $dbname = null): array + function dbCredentials(array $dsn, string $dbuser, string $dbpass, ?string $dbname = null): array { return Db::dbCredentials($dsn, $dbuser, $dbpass, $dbname); } @@ -160,7 +160,7 @@ function homeDir(string $path = ''): string * @deprecated Use `lucatume\WPBrowser\Utils\Filesystem::resolvePath` instead. * @return bool|string */ - function resolvePath(string $path, string $root = null) + function resolvePath(string $path, ?string $root = null) { return Filesystem::resolvePath($path, $root); } @@ -349,7 +349,7 @@ function urlDomain(string $fullUrl): string /** * @deprecated Use `Codeception\Util\Debug::isEnabled` instead. */ - function isDebug(bool $activate = null): bool + function isDebug(?bool $activate = null): bool { return Debug::isEnabled(); } @@ -417,7 +417,7 @@ function sanitize_user(string $username, bool $strict = false): string * @return array * @deprecated Use `lucatume\WPBrowser\Utils\WP::dropWpTables` instead. */ - function dropWpTables(wpdb $wpdb, array $tables = null): array + function dropWpTables(wpdb $wpdb, ?array $tables = null): array { return WP::dropWpTables($wpdb, $tables); } @@ -427,7 +427,7 @@ function dropWpTables(wpdb $wpdb, array $tables = null): array * @return array * @deprecated Use `lucatume\WPBrowser\Utils\WP::emptyWpTables` instead. */ - function emptyWpTables(wpdb $wpdb, array $tables = null): array + function emptyWpTables(wpdb $wpdb, ?array $tables = null): array { return WP::emptyWpTables($wpdb, $tables); } diff --git a/tests/_support/Traits/LoopIsolation.php b/tests/_support/Traits/LoopIsolation.php index 39baee9fd..412890494 100644 --- a/tests/_support/Traits/LoopIsolation.php +++ b/tests/_support/Traits/LoopIsolation.php @@ -19,7 +19,7 @@ trait LoopIsolation * @throws ProcessException * @return mixed */ - protected function assertInIsolation(Closure $runAssertions, string $cwd = null, array $requireFiles = []) + protected function assertInIsolation(Closure $runAssertions, ?string $cwd = null, ?array $requireFiles = []) { $options = ['cwd' => $cwd, 'rethrow' => false]; $callerFile = (new ReflectionObject($this))->getFileName(); diff --git a/tests/unit/lucatume/WPBrowser/ManagedProcess/PhpBuiltInServerTest.php b/tests/unit/lucatume/WPBrowser/ManagedProcess/PhpBuiltInServerTest.php index e3f94f7a0..b7de52520 100644 --- a/tests/unit/lucatume/WPBrowser/ManagedProcess/PhpBuiltInServerTest.php +++ b/tests/unit/lucatume/WPBrowser/ManagedProcess/PhpBuiltInServerTest.php @@ -22,8 +22,8 @@ class PhpBuiltinServerProcessMock extends Process */ public function __construct( array $command, - string $cwd = null, - array $env = null, + ?string $cwd = null, + ?array $env = null, $input = null, ?float $timeout = 60 ) { diff --git a/tests/unit/lucatume/WPBrowser/Module/WPLoaderArbitraryPluginLocationTest.php b/tests/unit/lucatume/WPBrowser/Module/WPLoaderArbitraryPluginLocationTest.php index f0f9aaa65..4ff9083b3 100644 --- a/tests/unit/lucatume/WPBrowser/Module/WPLoaderArbitraryPluginLocationTest.php +++ b/tests/unit/lucatume/WPBrowser/Module/WPLoaderArbitraryPluginLocationTest.php @@ -80,8 +80,83 @@ public function test_loads_plugins_from_default_location_correctly(): void /** * Plugin Name: Test One */ + +function test_one_loaded(){} +PHP + )) { + throw new \RuntimeException('Unable to create test plugin file for plugin test-one'); + } + if (!mkdir($projectDir . '/wp-content/plugins/test-two', 0777, true)) { + throw new \RuntimeException('Unable to create test directory for plugin test-two'); + } + if (!file_put_contents( + $projectDir . '/wp-content/plugins/test-two/plugin.php', + <<< PHP +config = [ + 'wpRootFolder' => $projectDir, + 'dbUrl' => $installationDb->getDbUrl(), + 'tablePrefix' => 'test_', + 'plugins' => [ + 'test-one/plugin.php', + 'test-two/plugin.php', + ] + ]; + $wpLoader = $this->module(); + $projectDirname = basename($projectDir); + + $this->assertInIsolation( + static function () use ($wpLoader, $projectDir) { + chdir($projectDir); + + $wpLoader->_initialize(); + + Assert::assertTrue(function_exists('test_one_loaded')); + Assert::assertTrue(function_exists('test_two_loaded')); + Assert::assertEquals( + ['test-one/plugin.php','test-two/plugin.php'], + get_option('active_plugins') + ); + global $wpdb; + Assert::assertEquals( + serialize(['test-one/plugin.php','test-two/plugin.php']), + $wpdb->get_var("select option_value from {$wpdb->prefix}options where option_name = 'active_plugins'") + ); + } + ); + } + + public function test_loads_plugins_and_ensures_them_loaded(): void + { + $projectDir = FS::tmpDir('wploader_'); + $installation = Installation::scaffold($projectDir); + $dbName = Random::dbName(); + $dbHost = Env::get('WORDPRESS_DB_HOST'); + $dbUser = Env::get('WORDPRESS_DB_USER'); + $dbPassword = Env::get('WORDPRESS_DB_PASSWORD'); + $installationDb = new MysqlDatabase($dbName, $dbUser, $dbPassword, $dbHost, 'wp_'); + if (!mkdir($projectDir . '/wp-content/plugins/test-one', 0777, true)) { + throw new \RuntimeException('Unable to create test directory for plugin test-one'); + } + if (!file_put_contents( + $projectDir . '/wp-content/plugins/test-one/plugin.php', + <<< PHP +get_var("select option_value from {$wpdb->prefix}options where option_name = 'active_plugins'") + ); } ); } diff --git a/tests/unit/lucatume/WPBrowser/Module/WPLoaderTest.php b/tests/unit/lucatume/WPBrowser/Module/WPLoaderTest.php index f879f81d0..c24f327a5 100644 --- a/tests/unit/lucatume/WPBrowser/Module/WPLoaderTest.php +++ b/tests/unit/lucatume/WPBrowser/Module/WPLoaderTest.php @@ -704,11 +704,11 @@ public function should_load_word_press_before_suite_if_load_only_w_config_files( Assert::assertFalse(defined('ABSPATH')); $actions = []; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_LOADONLY, static function () use (&$actions) { - $actions[] = WPLoader::EVENT_BEFORE_LOADONLY; + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_LOADONLY, static function () use (&$actions) { + $actions[] = \lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_LOADONLY; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_LOADONLY, static function () use (&$actions) { - $actions[] = WPLoader::EVENT_AFTER_LOADONLY; + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_LOADONLY, static function () use (&$actions) { + $actions[] = \lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_LOADONLY; }); $wpLoader->_loadWordPress(); @@ -716,8 +716,8 @@ public function should_load_word_press_before_suite_if_load_only_w_config_files( Assert::assertEquals('test_file_002.php', getenv('LOADED_2')); Assert::assertEquals($wpRootDir . '/', ABSPATH); Assert::assertEquals([ - WPLoader::EVENT_BEFORE_LOADONLY, - WPLoader::EVENT_AFTER_LOADONLY, + \lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_LOADONLY, + \lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_LOADONLY, ], $actions); Assert::assertInstanceOf(FactoryStore::class, $wpLoader->factory()); }); @@ -1022,10 +1022,10 @@ public function should_install_and_bootstrap_single_installation(): void $wpLoader = $this->module(); $this->assertInIsolation(static function () use ($wpLoader, $wpRootDir) { $actions = []; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_INSTALL, function () use (&$actions) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_INSTALL, function () use (&$actions) { $actions[] = 'before_install'; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_INSTALL, function () use (&$actions) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_INSTALL, function () use (&$actions) { $actions[] = 'after_install'; }); @@ -1113,10 +1113,10 @@ public function should_install_and_bootstrap_multisite_installation(): void $wpLoader = $this->module(); $installationOutput = $this->assertInIsolation(static function () use ($wpLoader, $wpRootDir) { $actions = []; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_INSTALL, function () use (&$actions) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_INSTALL, function () use (&$actions) { $actions[] = 'before_install'; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_INSTALL, function () use (&$actions) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_INSTALL, function () use (&$actions) { $actions[] = 'after_install'; }); @@ -2581,13 +2581,13 @@ static function () use ($wpLoader, $moduleSplObjectHash) { $beforeInstallCalled = false; $afterInstallCalled = false; $afterBootstrapCalled = false; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { $beforeInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { $afterInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { $afterBootstrapCalled = true; }); @@ -2628,13 +2628,13 @@ static function () use ($moduleSplObjectHash, $wpLoader) { $beforeInstallCalled = false; $afterInstallCalled = false; $afterBootstrapCalled = false; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { $beforeInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { $afterInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { $afterBootstrapCalled = true; }); @@ -2664,13 +2664,13 @@ static function () use ($wpLoader) { $beforeInstallCalled = false; $afterInstallCalled = false; $afterBootstrapCalled = false; - Dispatcher::addListener(WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_BEFORE_INSTALL, function () use (&$beforeInstallCalled) { $beforeInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_INSTALL, function () use (&$afterInstallCalled) { $afterInstallCalled = true; }); - Dispatcher::addListener(WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { + Dispatcher::addListener(\lucatume\WPBrowser\Module\WPLoader::EVENT_AFTER_BOOTSTRAP, function () use (&$afterBootstrapCalled) { $afterBootstrapCalled = true; }); uopz_set_return(Debug::class, 'isEnabled', true); diff --git a/tests/unit/lucatume/WPBrowser/Module/WPTestCaseStrictTest.php b/tests/unit/lucatume/WPBrowser/Module/WPTestCaseStrictTest.php index 1af2d27a5..80df6ee52 100644 --- a/tests/unit/lucatume/WPBrowser/Module/WPTestCaseStrictTest.php +++ b/tests/unit/lucatume/WPBrowser/Module/WPTestCaseStrictTest.php @@ -180,7 +180,7 @@ public function test_something():void{ public function should_not_be_strict_about_wpdb_connection_id_in_sq_lite_database(): void { $wpRootDir = FS::tmpDir('wploader_'); - $db = new SQLiteDatabase($wpRootDir, 'db.sqlite', 'wp_'); + $db = new SQLiteDatabase($wpRootDir, 'db.sqlite', 'wptests_'); Installation::scaffold($wpRootDir); $db->create(); $testcaseFile = $wpRootDir . '/BreakingTest.php';