Updated Rector to commit 86ccf3f6854c78c6b7b06b8471d922724cb6542b

86ccf3f685 [Testing] Use own FixtureFileFinder to keep dependency low (#2858)
This commit is contained in:
Tomas Votruba 2022-08-30 16:45:20 +00:00
parent d197e99c8b
commit 3a10283d3a
35 changed files with 26 additions and 1216 deletions

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357::getLoader();
return ComposerAutoloaderInit9925dc93bdd89dc64690fe2737f1c505::getLoader();

View File

@ -1,95 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../symplify/easy-testing/bin/easy-testing)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace RectorPrefix202208\Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..' . '/autoload.php';
if (\PHP_VERSION_ID < 80000) {
if (!\class_exists('RectorPrefix202208\\Composer\\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = \substr($path, 17);
$this->realpath = \realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = \fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = \fread($this->handle, $count);
if ($this->position === 0) {
$data = \preg_replace('{^#!.*\\r?\\n}', '', $data);
}
$this->position += \strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
\fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? \flock($this->handle, $operation) : \true;
}
public function stream_seek($offset, $whence)
{
if (0 === \fseek($this->handle, $offset, $whence)) {
$this->position = \ftell($this->handle);
return \true;
}
return \false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return \feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return \true;
}
public function url_stat($path, $flags)
{
$path = \substr($path, 17);
if (\file_exists($path)) {
return \stat($path);
}
return \false;
}
}
}
if (\function_exists('stream_get_wrappers') && \in_array('phpvfscomposer', \stream_get_wrappers(), \true) || \function_exists('stream_wrapper_register') && \stream_wrapper_register('phpvfscomposer', 'RectorPrefix202208\\Composer\\BinProxyWrapper')) {
include "phpvfscomposer://" . __DIR__ . '/..' . '/symplify/easy-testing/bin/easy-testing';
exit(0);
}
}
include __DIR__ . '/..' . '/symplify/easy-testing/bin/easy-testing';

View File

@ -1049,26 +1049,6 @@ return array(
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\ParallelProcess' => $vendorDir . '/symplify/easy-parallel/src/ValueObject/ParallelProcess.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\ProcessPool' => $vendorDir . '/symplify/easy-parallel/src/ValueObject/ProcessPool.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\Schedule' => $vendorDir . '/symplify/easy-parallel/src/ValueObject/Schedule.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Command\\ValidateFixtureSkipNamingCommand' => $vendorDir . '/symplify/easy-testing/src/Command/ValidateFixtureSkipNamingCommand.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\DataProvider\\StaticFixtureFinder' => $vendorDir . '/symplify/easy-testing/src/DataProvider/StaticFixtureFinder.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\DataProvider\\StaticFixtureUpdater' => $vendorDir . '/symplify/easy-testing/src/DataProvider/StaticFixtureUpdater.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Finder\\FixtureFinder' => $vendorDir . '/symplify/easy-testing/src/Finder/FixtureFinder.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\FixtureSplitter\\TrioFixtureSplitter' => $vendorDir . '/symplify/easy-testing/src/FixtureSplitter/TrioFixtureSplitter.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Kernel\\EasyTestingKernel' => $vendorDir . '/symplify/easy-testing/src/Kernel/EasyTestingKernel.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\MissplacedSkipPrefixResolver' => $vendorDir . '/symplify/easy-testing/src/MissplacedSkipPrefixResolver.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\PHPUnit\\Behavior\\DirectoryAssertableTrait' => $vendorDir . '/symplify/easy-testing/src/PHPUnit/Behavior/DirectoryAssertableTrait.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\PHPUnit\\StaticPHPUnitEnvironment' => $vendorDir . '/symplify/easy-testing/src/PHPUnit/StaticPHPUnitEnvironment.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\StaticFixtureSplitter' => $vendorDir . '/symplify/easy-testing/src/StaticFixtureSplitter.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\EasyTestingConfig' => $vendorDir . '/symplify/easy-testing/src/ValueObject/EasyTestingConfig.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\ExpectedAndOutputFileInfoPair' => $vendorDir . '/symplify/easy-testing/src/ValueObject/ExpectedAndOutputFileInfoPair.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\FixtureSplit\\TrioContent' => $vendorDir . '/symplify/easy-testing/src/ValueObject/FixtureSplit/TrioContent.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\IncorrectAndMissingSkips' => $vendorDir . '/symplify/easy-testing/src/ValueObject/IncorrectAndMissingSkips.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputAndExpected' => $vendorDir . '/symplify/easy-testing/src/ValueObject/InputAndExpected.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputFileInfoAndExpected' => $vendorDir . '/symplify/easy-testing/src/ValueObject/InputFileInfoAndExpected.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputFileInfoAndExpectedFileInfo' => $vendorDir . '/symplify/easy-testing/src/ValueObject/InputFileInfoAndExpectedFileInfo.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\Option' => $vendorDir . '/symplify/easy-testing/src/ValueObject/Option.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\Prefix' => $vendorDir . '/symplify/easy-testing/src/ValueObject/Prefix.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\SplitLine' => $vendorDir . '/symplify/easy-testing/src/ValueObject/SplitLine.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Composer\\VendorDirProvider' => $vendorDir . '/symplify/package-builder/src/Composer/VendorDirProvider.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Configuration\\StaticEolConfiguration' => $vendorDir . '/symplify/package-builder/src/Configuration/StaticEolConfiguration.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Console\\Command\\AbstractSymplifyCommand' => $vendorDir . '/symplify/package-builder/src/Console/Command/AbstractSymplifyCommand.php',

View File

@ -24,7 +24,6 @@ return array(
'RectorPrefix202208\\Symplify\\SmartFileSystem\\' => array($vendorDir . '/symplify/smart-file-system/src'),
'RectorPrefix202208\\Symplify\\Skipper\\' => array($vendorDir . '/symplify/skipper/src'),
'RectorPrefix202208\\Symplify\\PackageBuilder\\' => array($vendorDir . '/symplify/package-builder/src'),
'RectorPrefix202208\\Symplify\\EasyTesting\\' => array($vendorDir . '/symplify/easy-testing/src'),
'RectorPrefix202208\\Symplify\\EasyParallel\\' => array($vendorDir . '/symplify/easy-parallel/src'),
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\' => array($vendorDir . '/symplify/composer-json-manipulator/src'),
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\' => array($vendorDir . '/symplify/autowire-array-parameter/src'),

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357
class ComposerAutoloaderInit9925dc93bdd89dc64690fe2737f1c505
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit9925dc93bdd89dc64690fe2737f1c505', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit9925dc93bdd89dc64690fe2737f1c505', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitd0502117be6e6d45dc8ce25866585357::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitd0502117be6e6d45dc8ce25866585357::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequired0502117be6e6d45dc8ce25866585357($fileIdentifier, $file);
composerRequire9925dc93bdd89dc64690fe2737f1c505($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitd0502117be6e6d45dc8ce25866585357
* @param string $file
* @return void
*/
function composerRequired0502117be6e6d45dc8ce25866585357($fileIdentifier, $file)
function composerRequire9925dc93bdd89dc64690fe2737f1c505($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitd0502117be6e6d45dc8ce25866585357
class ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -41,7 +41,6 @@ class ComposerStaticInitd0502117be6e6d45dc8ce25866585357
'RectorPrefix202208\\Symplify\\SmartFileSystem\\' => 44,
'RectorPrefix202208\\Symplify\\Skipper\\' => 36,
'RectorPrefix202208\\Symplify\\PackageBuilder\\' => 43,
'RectorPrefix202208\\Symplify\\EasyTesting\\' => 40,
'RectorPrefix202208\\Symplify\\EasyParallel\\' => 41,
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\' => 52,
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\' => 51,
@ -156,10 +155,6 @@ class ComposerStaticInitd0502117be6e6d45dc8ce25866585357
array (
0 => __DIR__ . '/..' . '/symplify/package-builder/src',
),
'RectorPrefix202208\\Symplify\\EasyTesting\\' =>
array (
0 => __DIR__ . '/..' . '/symplify/easy-testing/src',
),
'RectorPrefix202208\\Symplify\\EasyParallel\\' =>
array (
0 => __DIR__ . '/..' . '/symplify/easy-parallel/src',
@ -1334,26 +1329,6 @@ class ComposerStaticInitd0502117be6e6d45dc8ce25866585357
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\ParallelProcess' => __DIR__ . '/..' . '/symplify/easy-parallel/src/ValueObject/ParallelProcess.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\ProcessPool' => __DIR__ . '/..' . '/symplify/easy-parallel/src/ValueObject/ProcessPool.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\ValueObject\\Schedule' => __DIR__ . '/..' . '/symplify/easy-parallel/src/ValueObject/Schedule.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Command\\ValidateFixtureSkipNamingCommand' => __DIR__ . '/..' . '/symplify/easy-testing/src/Command/ValidateFixtureSkipNamingCommand.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\DataProvider\\StaticFixtureFinder' => __DIR__ . '/..' . '/symplify/easy-testing/src/DataProvider/StaticFixtureFinder.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\DataProvider\\StaticFixtureUpdater' => __DIR__ . '/..' . '/symplify/easy-testing/src/DataProvider/StaticFixtureUpdater.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Finder\\FixtureFinder' => __DIR__ . '/..' . '/symplify/easy-testing/src/Finder/FixtureFinder.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\FixtureSplitter\\TrioFixtureSplitter' => __DIR__ . '/..' . '/symplify/easy-testing/src/FixtureSplitter/TrioFixtureSplitter.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\Kernel\\EasyTestingKernel' => __DIR__ . '/..' . '/symplify/easy-testing/src/Kernel/EasyTestingKernel.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\MissplacedSkipPrefixResolver' => __DIR__ . '/..' . '/symplify/easy-testing/src/MissplacedSkipPrefixResolver.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\PHPUnit\\Behavior\\DirectoryAssertableTrait' => __DIR__ . '/..' . '/symplify/easy-testing/src/PHPUnit/Behavior/DirectoryAssertableTrait.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\PHPUnit\\StaticPHPUnitEnvironment' => __DIR__ . '/..' . '/symplify/easy-testing/src/PHPUnit/StaticPHPUnitEnvironment.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\StaticFixtureSplitter' => __DIR__ . '/..' . '/symplify/easy-testing/src/StaticFixtureSplitter.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\EasyTestingConfig' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/EasyTestingConfig.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\ExpectedAndOutputFileInfoPair' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/ExpectedAndOutputFileInfoPair.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\FixtureSplit\\TrioContent' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/FixtureSplit/TrioContent.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\IncorrectAndMissingSkips' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/IncorrectAndMissingSkips.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputAndExpected' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/InputAndExpected.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputFileInfoAndExpected' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/InputFileInfoAndExpected.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\InputFileInfoAndExpectedFileInfo' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/InputFileInfoAndExpectedFileInfo.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\Option' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/Option.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\Prefix' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/Prefix.php',
'RectorPrefix202208\\Symplify\\EasyTesting\\ValueObject\\SplitLine' => __DIR__ . '/..' . '/symplify/easy-testing/src/ValueObject/SplitLine.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Composer\\VendorDirProvider' => __DIR__ . '/..' . '/symplify/package-builder/src/Composer/VendorDirProvider.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Configuration\\StaticEolConfiguration' => __DIR__ . '/..' . '/symplify/package-builder/src/Configuration/StaticEolConfiguration.php',
'RectorPrefix202208\\Symplify\\PackageBuilder\\Console\\Command\\AbstractSymplifyCommand' => __DIR__ . '/..' . '/symplify/package-builder/src/Console/Command/AbstractSymplifyCommand.php',
@ -3195,9 +3170,9 @@ class ComposerStaticInitd0502117be6e6d45dc8ce25866585357
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitd0502117be6e6d45dc8ce25866585357::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd0502117be6e6d45dc8ce25866585357::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd0502117be6e6d45dc8ce25866585357::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9925dc93bdd89dc64690fe2737f1c505::$classMap;
}, null, ClassLoader::class);
}

View File

@ -3341,89 +3341,6 @@
},
"install-path": "..\/symplify\/easy-parallel"
},
{
"name": "symplify\/easy-testing",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/easy-testing.git",
"reference": "c89e13e097d453a62adeb9d7b10b425fcaca6b34"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/easy-testing\/zipball\/c89e13e097d453a62adeb9d7b10b425fcaca6b34",
"reference": "c89e13e097d453a62adeb9d7b10b425fcaca6b34",
"shasum": ""
},
"require": {
"nette\/utils": "^3.2",
"php": ">=8.0",
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/finder": "^6.0",
"symplify\/package-builder": "^11.2",
"symplify\/smart-file-system": "^11.2",
"symplify\/symplify-kernel": "^11.2"
},
"conflict": {
"symplify\/autowire-array-parameter": "<11.1.5",
"symplify\/coding-standard": "<11.1.5",
"symplify\/composer-json-manipulator": "<11.1.5",
"symplify\/config-transformer": "<11.1.5",
"symplify\/easy-ci": "<11.1.5",
"symplify\/easy-coding-standard": "<11.1.5",
"symplify\/easy-parallel": "<11.1.5",
"symplify\/monorepo-builder": "<11.1.5",
"symplify\/php-config-printer": "<11.1.5",
"symplify\/phpstan-extensions": "<11.1.5",
"symplify\/phpstan-rules": "<11.1.5",
"symplify\/rule-doc-generator": "<11.1.5",
"symplify\/rule-doc-generator-contracts": "<11.1.5",
"symplify\/skipper": "<11.1.5",
"symplify\/symfony-static-dumper": "<11.1.5",
"symplify\/vendor-patches": "<11.1.5"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-30T00:33:39+00:00",
"default-branch": true,
"bin": [
"bin\/easy-testing"
],
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-main": "11.2-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"RectorPrefix202208\\Symplify\\EasyTesting\\": "src"
}
},
"notification-url": "https:\/\/packagist.org\/downloads\/",
"license": [
"MIT"
],
"description": "Testing made easy",
"support": {
"source": "https:\/\/github.com\/symplify\/easy-testing\/tree\/main"
},
"funding": [
{
"url": "https:\/\/www.paypal.me\/rectorphp",
"type": "custom"
},
{
"url": "https:\/\/github.com\/tomasvotruba",
"type": "github"
}
],
"install-path": "..\/symplify\/easy-testing"
},
{
"name": "symplify\/package-builder",
"version": "dev-main",
@ -3431,12 +3348,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/package-builder.git",
"reference": "79faaedbdc8e171b5a561ad00368450fd64db51c"
"reference": "3405555388ceb5e6d13d34e5ac7dc7dbebbbb4b1"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/79faaedbdc8e171b5a561ad00368450fd64db51c",
"reference": "79faaedbdc8e171b5a561ad00368450fd64db51c",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/3405555388ceb5e6d13d34e5ac7dc7dbebbbb4b1",
"reference": "3405555388ceb5e6d13d34e5ac7dc7dbebbbb4b1",
"shasum": ""
},
"require": {
@ -3447,7 +3364,6 @@
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/finder": "^6.0",
"symplify\/easy-testing": "^11.2",
"symplify\/symplify-kernel": "^11.2"
},
"conflict": {
@ -3472,7 +3388,7 @@
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-30T00:33:41+00:00",
"time": "2022-08-30T16:38:59+00:00",
"default-branch": true,
"type": "library",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -1,25 +0,0 @@
The MIT License
---------------
Copyright (c) 2020 Tomas Votruba (https://tomasvotruba.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,5 +0,0 @@
#!/usr/bin/env php
<?php
namespace RectorPrefix202208;
require __DIR__ . '/easy-testing.php';

View File

@ -1,23 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
use RectorPrefix202208\Symplify\EasyTesting\Kernel\EasyTestingKernel;
use RectorPrefix202208\Symplify\SymplifyKernel\ValueObject\KernelBootAndApplicationRun;
$possibleAutoloadPaths = [
// dependency
__DIR__ . '/../../../autoload.php',
// after split package
__DIR__ . '/../vendor/autoload.php',
// monorepo
__DIR__ . '/../../../vendor/autoload.php',
];
foreach ($possibleAutoloadPaths as $possibleAutoloadPath) {
if (\file_exists($possibleAutoloadPath)) {
require_once $possibleAutoloadPath;
break;
}
}
$kernelBootAndApplicationRun = new KernelBootAndApplicationRun(EasyTestingKernel::class);
$kernelBootAndApplicationRun->run();

View File

@ -1,57 +0,0 @@
{
"name": "symplify\/easy-testing",
"description": "Testing made easy",
"license": "MIT",
"type": "symfony-bundle",
"bin": [
"bin\/easy-testing"
],
"require": {
"php": ">=8.0",
"nette\/utils": "^3.2",
"symfony\/finder": "^6.0",
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symplify\/package-builder": "^11.2",
"symplify\/smart-file-system": "^11.2",
"symplify\/symplify-kernel": "^11.2"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"autoload": {
"psr-4": {
"RectorPrefix202208\\Symplify\\EasyTesting\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"RectorPrefix202208\\Symplify\\EasyTesting\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-main": "11.2-dev"
}
},
"conflict": {
"symplify\/composer-json-manipulator": "<11.1.5",
"symplify\/easy-coding-standard": "<11.1.5",
"symplify\/phpstan-rules": "<11.1.5",
"symplify\/rule-doc-generator-contracts": "<11.1.5",
"symplify\/php-config-printer": "<11.1.5",
"symplify\/autowire-array-parameter": "<11.1.5",
"symplify\/phpstan-extensions": "<11.1.5",
"symplify\/rule-doc-generator": "<11.1.5",
"symplify\/vendor-patches": "<11.1.5",
"symplify\/skipper": "<11.1.5",
"symplify\/symfony-static-dumper": "<11.1.5",
"symplify\/monorepo-builder": "<11.1.5",
"symplify\/config-transformer": "<11.1.5",
"symplify\/easy-ci": "<11.1.5",
"symplify\/coding-standard": "<11.1.5",
"symplify\/easy-parallel": "<11.1.5"
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -1,16 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
use RectorPrefix202208\Symfony\Component\Console\Application;
use RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use RectorPrefix202208\Symplify\EasyTesting\Command\ValidateFixtureSkipNamingCommand;
use function RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $containerConfigurator) : void {
$services = $containerConfigurator->services();
$services->defaults()->public()->autowire();
$services->load('RectorPrefix202208\Symplify\\EasyTesting\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/DataProvider', __DIR__ . '/../src/Kernel', __DIR__ . '/../src/ValueObject']);
// console
$services->set(Application::class)->call('add', [service(ValidateFixtureSkipNamingCommand::class)]);
};

View File

@ -1,58 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\Command;
use RectorPrefix202208\Symfony\Component\Console\Input\InputArgument;
use RectorPrefix202208\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202208\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202208\Symplify\EasyTesting\Finder\FixtureFinder;
use RectorPrefix202208\Symplify\EasyTesting\MissplacedSkipPrefixResolver;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\Option;
use RectorPrefix202208\Symplify\PackageBuilder\Console\Command\AbstractSymplifyCommand;
final class ValidateFixtureSkipNamingCommand extends AbstractSymplifyCommand
{
/**
* @var \Symplify\EasyTesting\MissplacedSkipPrefixResolver
*/
private $missplacedSkipPrefixResolver;
/**
* @var \Symplify\EasyTesting\Finder\FixtureFinder
*/
private $fixtureFinder;
public function __construct(MissplacedSkipPrefixResolver $missplacedSkipPrefixResolver, FixtureFinder $fixtureFinder)
{
$this->missplacedSkipPrefixResolver = $missplacedSkipPrefixResolver;
$this->fixtureFinder = $fixtureFinder;
parent::__construct();
}
protected function configure() : void
{
$this->setName('validate-fixture-skip-naming');
$this->addArgument(Option::SOURCE, InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Paths to analyse');
$this->setDescription('Check that skipped fixture files (without `-----` separator) have a "skip" prefix');
}
protected function execute(InputInterface $input, OutputInterface $output) : int
{
$source = (array) $input->getArgument(Option::SOURCE);
$fixtureFileInfos = $this->fixtureFinder->find($source);
$incorrectAndMissingSkips = $this->missplacedSkipPrefixResolver->resolve($fixtureFileInfos);
foreach ($incorrectAndMissingSkips->getIncorrectSkipFileInfos() as $incorrectSkipFileInfo) {
$errorMessage = \sprintf('The file "%s" should drop the "skip/keep" prefix', $incorrectSkipFileInfo->getRelativeFilePathFromCwd());
$this->symfonyStyle->note($errorMessage);
}
foreach ($incorrectAndMissingSkips->getMissingSkipFileInfos() as $missingSkipFileInfo) {
$errorMessage = \sprintf('The file "%s" should start with "skip/keep" prefix', $missingSkipFileInfo->getRelativeFilePathFromCwd());
$this->symfonyStyle->note($errorMessage);
}
$countError = $incorrectAndMissingSkips->getFileCount();
if ($incorrectAndMissingSkips->getFileCount() === 0) {
$message = \sprintf('All %d fixture files have valid names', \count($fixtureFileInfos));
$this->symfonyStyle->success($message);
return self::SUCCESS;
}
$errorMessage = \sprintf('Found %d test file fixtures with wrong prefix', $countError);
$this->symfonyStyle->error($errorMessage);
return self::FAILURE;
}
}

View File

@ -1,112 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\DataProvider;
use Iterator;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symfony\Component\Finder\Finder;
use RectorPrefix202208\Symfony\Component\Finder\SplFileInfo;
use RectorPrefix202208\Symplify\SmartFileSystem\Exception\FileNotFoundException;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SymplifyKernel\Exception\ShouldNotHappenException;
/**
* @api
* @see \Symplify\EasyTesting\Tests\DataProvider\StaticFixtureFinder\StaticFixtureFinderTest
*/
final class StaticFixtureFinder
{
/**
* @return Iterator<array<int, SmartFileInfo>>
*/
public static function yieldDirectory(string $directory, string $suffix = '*.php.inc') : Iterator
{
$fileInfos = self::findFilesInDirectory($directory, $suffix);
return self::yieldFileInfos($fileInfos);
}
/**
* @return Iterator<SmartFileInfo>
*/
public static function yieldDirectoryExclusively(string $directory, string $suffix = '*.php.inc') : Iterator
{
$fileInfos = self::findFilesInDirectoryExclusively($directory, $suffix);
return self::yieldFileInfos($fileInfos);
}
/**
* @return Iterator<string, array<int, SmartFileInfo>>
*/
public static function yieldDirectoryWithRelativePathname(string $directory, string $suffix = '*.php.inc') : Iterator
{
$fileInfos = self::findFilesInDirectory($directory, $suffix);
return self::yieldFileInfosWithRelativePathname($fileInfos);
}
/**
* @return Iterator<string, array<int, SmartFileInfo>>
*/
public static function yieldDirectoryExclusivelyWithRelativePathname(string $directory, string $suffix = '*.php.inc') : Iterator
{
$fileInfos = self::findFilesInDirectoryExclusively($directory, $suffix);
return self::yieldFileInfosWithRelativePathname($fileInfos);
}
/**
* @param SplFileInfo[] $fileInfos
* @return Iterator<array<int, SmartFileInfo>>
*/
private static function yieldFileInfos(array $fileInfos) : Iterator
{
foreach ($fileInfos as $fileInfo) {
try {
$smartFileInfo = new SmartFileInfo($fileInfo->getRealPath());
(yield [$smartFileInfo]);
} catch (FileNotFoundException $exception) {
}
}
}
/**
* @param SplFileInfo[] $fileInfos
* @return Iterator<string, array<int, SmartFileInfo>>
*/
private static function yieldFileInfosWithRelativePathname(array $fileInfos) : Iterator
{
foreach ($fileInfos as $fileInfo) {
try {
$smartFileInfo = new SmartFileInfo($fileInfo->getRealPath());
(yield $fileInfo->getRelativePathname() => [$smartFileInfo]);
} catch (FileNotFoundException $exception) {
}
}
}
/**
* @return SplFileInfo[]
*/
private static function findFilesInDirectory(string $directory, string $suffix) : array
{
$finder = Finder::create()->in($directory)->files()->name($suffix);
$fileInfos = \iterator_to_array($finder);
return \array_values($fileInfos);
}
/**
* @return SplFileInfo[]
*/
private static function findFilesInDirectoryExclusively(string $directory, string $suffix) : array
{
self::ensureNoOtherFileName($directory, $suffix);
$finder = Finder::create()->in($directory)->files()->name($suffix);
$fileInfos = \iterator_to_array($finder->getIterator());
return \array_values($fileInfos);
}
private static function ensureNoOtherFileName(string $directory, string $suffix) : void
{
$finder = Finder::create()->in($directory)->files()->notName($suffix);
/** @var SplFileInfo[] $fileInfos */
$fileInfos = \iterator_to_array($finder->getIterator());
$relativeFilePaths = [];
foreach ($fileInfos as $fileInfo) {
$relativeFilePaths[] = Strings::substring($fileInfo->getRealPath(), \strlen(\getcwd()) + 1);
}
if ($relativeFilePaths === []) {
return;
}
throw new ShouldNotHappenException(\sprintf('Files "%s" have invalid suffix, use "%s" suffix instead', \implode('", ', $relativeFilePaths), $suffix));
}
}

View File

@ -1,50 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\DataProvider;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SmartFileSystem\SmartFileSystem;
/**
* @api
*/
final class StaticFixtureUpdater
{
/**
* @param \Symplify\SmartFileSystem\SmartFileInfo|string $originalFileInfo
*/
public static function updateFixtureContent($originalFileInfo, string $changedContent, SmartFileInfo $fixtureFileInfo) : void
{
if (!\getenv('UPDATE_TESTS') && !\getenv('UT')) {
return;
}
$newOriginalContent = self::resolveNewFixtureContent($originalFileInfo, $changedContent);
self::getSmartFileSystem()->dumpFile($fixtureFileInfo->getRealPath(), $newOriginalContent);
}
public static function updateExpectedFixtureContent(string $newOriginalContent, SmartFileInfo $expectedFixtureFileInfo) : void
{
if (!\getenv('UPDATE_TESTS') && !\getenv('UT')) {
return;
}
self::getSmartFileSystem()->dumpFile($expectedFixtureFileInfo->getRealPath(), $newOriginalContent);
}
private static function getSmartFileSystem() : SmartFileSystem
{
return new SmartFileSystem();
}
/**
* @param \Symplify\SmartFileSystem\SmartFileInfo|string $originalFileInfo
*/
private static function resolveNewFixtureContent($originalFileInfo, string $changedContent) : string
{
if ($originalFileInfo instanceof SmartFileInfo) {
$originalContent = $originalFileInfo->getContents();
} else {
$originalContent = $originalFileInfo;
}
if ($originalContent === $changedContent) {
return $originalContent;
}
return $originalContent . '-----' . \PHP_EOL . $changedContent;
}
}

View File

@ -1,29 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\Finder;
use RectorPrefix202208\Symfony\Component\Finder\Finder;
use RectorPrefix202208\Symplify\SmartFileSystem\Finder\FinderSanitizer;
use Symplify\SmartFileSystem\SmartFileInfo;
final class FixtureFinder
{
/**
* @var \Symplify\SmartFileSystem\Finder\FinderSanitizer
*/
private $finderSanitizer;
public function __construct(FinderSanitizer $finderSanitizer)
{
$this->finderSanitizer = $finderSanitizer;
}
/**
* @param string[] $sources
* @return SmartFileInfo[]
*/
public function find(array $sources) : array
{
$finder = new Finder();
$finder->files()->in($sources)->name('*.php.inc')->path('Fixture')->sortByName();
return $this->finderSanitizer->sanitize($finder);
}
}

View File

@ -1,33 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\FixtureSplitter;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\FixtureSplit\TrioContent;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\SplitLine;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SymplifyKernel\Exception\ShouldNotHappenException;
/**
* @api
*/
final class TrioFixtureSplitter
{
public function splitFileInfo(SmartFileInfo $smartFileInfo) : TrioContent
{
$parts = Strings::split($smartFileInfo->getContents(), SplitLine::SPLIT_LINE_REGEX);
$this->ensureHasThreeParts($parts, $smartFileInfo);
return new TrioContent($parts[0], $parts[1], $parts[2]);
}
/**
* @param mixed[] $parts
*/
private function ensureHasThreeParts(array $parts, SmartFileInfo $smartFileInfo) : void
{
if (\count($parts) === 3) {
return;
}
$message = \sprintf('The fixture "%s" should have 3 parts. %d found', $smartFileInfo->getRelativeFilePathFromCwd(), \count($parts));
throw new ShouldNotHappenException($message);
}
}

View File

@ -1,19 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\Kernel;
use RectorPrefix202208\Psr\Container\ContainerInterface;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\EasyTestingConfig;
use RectorPrefix202208\Symplify\SymplifyKernel\HttpKernel\AbstractSymplifyKernel;
final class EasyTestingKernel extends AbstractSymplifyKernel
{
/**
* @param string[] $configFiles
*/
public function createFromConfigs(array $configFiles) : ContainerInterface
{
$configFiles[] = EasyTestingConfig::FILE_PATH;
return $this->create($configFiles);
}
}

View File

@ -1,41 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\IncorrectAndMissingSkips;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\Prefix;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\SplitLine;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* @see \Symplify\EasyTesting\Tests\MissingSkipPrefixResolver\MissingSkipPrefixResolverTest
*/
final class MissplacedSkipPrefixResolver
{
/**
* @param SmartFileInfo[] $fixtureFileInfos
*/
public function resolve(array $fixtureFileInfos) : IncorrectAndMissingSkips
{
$incorrectSkips = [];
$missingSkips = [];
foreach ($fixtureFileInfos as $fixtureFileInfo) {
$hasNameSkipStart = $this->hasNameSkipStart($fixtureFileInfo);
$fileContents = $fixtureFileInfo->getContents();
$hasSplitLine = (bool) Strings::match($fileContents, SplitLine::SPLIT_LINE_REGEX);
if ($hasNameSkipStart && $hasSplitLine) {
$incorrectSkips[] = $fixtureFileInfo;
continue;
}
if (!$hasNameSkipStart && !$hasSplitLine) {
$missingSkips[] = $fixtureFileInfo;
}
}
return new IncorrectAndMissingSkips($incorrectSkips, $missingSkips);
}
private function hasNameSkipStart(SmartFileInfo $fixtureFileInfo) : bool
{
return (bool) Strings::match($fixtureFileInfo->getBasenameWithoutSuffix(), Prefix::SKIP_PREFIX_REGEX);
}
}

View File

@ -1,75 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\PHPUnit\Behavior;
use RectorPrefix202208\Symfony\Component\Finder\Finder;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\ExpectedAndOutputFileInfoPair;
use RectorPrefix202208\Symplify\SmartFileSystem\Finder\FinderSanitizer;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* Use only in "\PHPUnit\Framework\TestCase"
*
* Answer here
*
* @api
* @see https://stackoverflow.com/questions/54263109/how-to-assert-2-directories-are-identical-in-phpunit
*/
trait DirectoryAssertableTrait
{
protected function assertDirectoryEquals(string $expectedDirectory, string $outputDirectory) : void
{
$expectedFileInfos = $this->findFileInfosInDirectory($expectedDirectory);
$outputFileInfos = $this->findFileInfosInDirectory($outputDirectory);
$fileInfosByRelativeFilePath = $this->groupFileInfosByRelativeFilePath($expectedFileInfos, $expectedDirectory, $outputFileInfos, $outputDirectory);
foreach ($fileInfosByRelativeFilePath as $relativeFilePath => $expectedAndOutputFileInfoPair) {
// output file exists
$this->assertFileExists($outputDirectory . '/' . $relativeFilePath);
if (!$expectedAndOutputFileInfoPair->doesOutputFileExist()) {
continue;
}
// they have the same content
$this->assertSame($expectedAndOutputFileInfoPair->getExpectedFileContent(), $expectedAndOutputFileInfoPair->getOutputFileContent(), $relativeFilePath);
}
}
/**
* @return SmartFileInfo[]
*/
private function findFileInfosInDirectory(string $directory) : array
{
$firstDirectoryFinder = new Finder();
$firstDirectoryFinder->files()->in($directory);
$finderSanitizer = new FinderSanitizer();
return $finderSanitizer->sanitize($firstDirectoryFinder);
}
/**
* @param SmartFileInfo[] $expectedFileInfos
* @param SmartFileInfo[] $outputFileInfos
* @return array<string, ExpectedAndOutputFileInfoPair>
*/
private function groupFileInfosByRelativeFilePath(array $expectedFileInfos, string $expectedDirectory, array $outputFileInfos, string $outputDirectory) : array
{
$fileInfosByRelativeFilePath = [];
foreach ($expectedFileInfos as $expectedFileInfo) {
$relativeFilePath = $expectedFileInfo->getRelativeFilePathFromDirectory($expectedDirectory);
// match output file info
$outputFileInfo = $this->resolveFileInfoByRelativeFilePath($outputFileInfos, $outputDirectory, $relativeFilePath);
$fileInfosByRelativeFilePath[$relativeFilePath] = new ExpectedAndOutputFileInfoPair($expectedFileInfo, $outputFileInfo);
}
return $fileInfosByRelativeFilePath;
}
/**
* @param SmartFileInfo[] $fileInfos
*/
private function resolveFileInfoByRelativeFilePath(array $fileInfos, string $directory, string $desiredRelativeFilePath) : ?SmartFileInfo
{
foreach ($fileInfos as $fileInfo) {
$relativeFilePath = $fileInfo->getRelativeFilePathFromDirectory($directory);
if ($desiredRelativeFilePath !== $relativeFilePath) {
continue;
}
return $fileInfo;
}
return null;
}
}

View File

@ -1,18 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\PHPUnit;
/**
* @api
*/
final class StaticPHPUnitEnvironment
{
/**
* Never ever used static methods if not neccesary, this is just handy for tests + src to prevent duplication.
*/
public static function isPHPUnitRun() : bool
{
return \defined('RectorPrefix202208\\PHPUNIT_COMPOSER_INSTALL') || \defined('RectorPrefix202208\\__PHPUNIT_PHAR__');
}
}

View File

@ -1,104 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\InputAndExpected;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\InputFileInfoAndExpected;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\InputFileInfoAndExpectedFileInfo;
use RectorPrefix202208\Symplify\EasyTesting\ValueObject\SplitLine;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SmartFileSystem\SmartFileSystem;
/**
* @api
*/
final class StaticFixtureSplitter
{
/**
* @var string|null
*/
public static $customTemporaryPath;
public static function splitFileInfoToInputAndExpected(SmartFileInfo $smartFileInfo) : InputAndExpected
{
$splitLineCount = \count(Strings::matchAll($smartFileInfo->getContents(), SplitLine::SPLIT_LINE_REGEX));
// if more or less, it could be a test cases for monorepo line in it
if ($splitLineCount === 1) {
// input → expected
[$input, $expected] = Strings::split($smartFileInfo->getContents(), SplitLine::SPLIT_LINE_REGEX);
$expected = self::retypeExpected($expected);
return new InputAndExpected($input, $expected);
}
// no changes
return new InputAndExpected($smartFileInfo->getContents(), $smartFileInfo->getContents());
}
public static function splitFileInfoToLocalInputAndExpectedFileInfos(SmartFileInfo $smartFileInfo, bool $autoloadTestFixture = \false, bool $preserveDirStructure = \false) : InputFileInfoAndExpectedFileInfo
{
$inputAndExpected = self::splitFileInfoToInputAndExpected($smartFileInfo);
$prefix = '';
if ($preserveDirStructure) {
$dir = \explode('Fixture', $smartFileInfo->getRealPath(), 2);
$prefix = isset($dir[1]) ? \dirname($dir[1]) . '/' : '';
$prefix = \ltrim($prefix, '/\\');
}
$inputFileInfo = self::createTemporaryFileInfo($smartFileInfo, $prefix . 'input', $inputAndExpected->getInput());
// some files needs to be autoload to enable reflection
if ($autoloadTestFixture) {
require_once $inputFileInfo->getRealPath();
}
$expectedFileInfo = self::createTemporaryFileInfo($smartFileInfo, $prefix . 'expected', $inputAndExpected->getExpected());
return new InputFileInfoAndExpectedFileInfo($inputFileInfo, $expectedFileInfo);
}
public static function getTemporaryPath() : string
{
if (self::$customTemporaryPath !== null) {
return self::$customTemporaryPath;
}
return \sys_get_temp_dir() . '/_temp_fixture_easy_testing';
}
public static function createTemporaryFileInfo(SmartFileInfo $fixtureSmartFileInfo, string $prefix, string $fileContent) : SmartFileInfo
{
$temporaryFilePath = self::createTemporaryPathWithPrefix($fixtureSmartFileInfo, $prefix);
$dir = \dirname($temporaryFilePath);
if (!\is_dir($dir)) {
\mkdir($dir, 0777, \true);
}
/** @phpstan-ignore-next-line we don't use SmartFileSystem->dump() for performance reasons */
\file_put_contents($temporaryFilePath, $fileContent);
return new SmartFileInfo($temporaryFilePath);
}
public static function splitFileInfoToLocalInputAndExpected(SmartFileInfo $smartFileInfo, bool $autoloadTestFixture = \false) : InputFileInfoAndExpected
{
$inputAndExpected = self::splitFileInfoToInputAndExpected($smartFileInfo);
$inputFileInfo = self::createTemporaryFileInfo($smartFileInfo, 'input', $inputAndExpected->getInput());
// some files needs to be autoload to enable reflection
if ($autoloadTestFixture) {
require_once $inputFileInfo->getRealPath();
}
return new InputFileInfoAndExpected($inputFileInfo, $inputAndExpected->getExpected());
}
private static function createTemporaryPathWithPrefix(SmartFileInfo $smartFileInfo, string $prefix) : string
{
$hash = Strings::substring(\md5($smartFileInfo->getRealPath()), -20);
$fileBasename = $smartFileInfo->getBasename('.inc');
return self::getTemporaryPath() . \sprintf('/%s_%s_%s', $prefix, $hash, $fileBasename);
}
/**
* @param mixed $expected
* @return mixed
*/
private static function retypeExpected($expected)
{
if (!\is_numeric(\trim($expected))) {
return $expected;
}
// value re-type
if (\strlen((string) (int) $expected) === \strlen(\trim($expected))) {
return (int) $expected;
}
if (\strlen((string) (float) $expected) === \strlen(\trim($expected))) {
return (float) $expected;
}
return $expected;
}
}

View File

@ -1,15 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
/**
* @api
*/
final class EasyTestingConfig
{
/**
* @var string
*/
public const FILE_PATH = __DIR__ . '/../../config/config.php';
}

View File

@ -1,47 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SymplifyKernel\Exception\ShouldNotHappenException;
final class ExpectedAndOutputFileInfoPair
{
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo
*/
private $expectedFileInfo;
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo|null
*/
private $outputFileInfo;
public function __construct(SmartFileInfo $expectedFileInfo, ?SmartFileInfo $outputFileInfo)
{
$this->expectedFileInfo = $expectedFileInfo;
$this->outputFileInfo = $outputFileInfo;
}
/**
* @noRector \Rector\Privatization\Rector\ClassMethod\PrivatizeLocalOnlyMethodRector
*/
public function getExpectedFileContent() : string
{
return $this->expectedFileInfo->getContents();
}
/**
* @noRector \Rector\Privatization\Rector\ClassMethod\PrivatizeLocalOnlyMethodRector
*/
public function getOutputFileContent() : string
{
if (!$this->outputFileInfo instanceof SmartFileInfo) {
throw new ShouldNotHappenException();
}
return $this->outputFileInfo->getContents();
}
/**
* @noRector \Rector\Privatization\Rector\ClassMethod\PrivatizeLocalOnlyMethodRector
*/
public function doesOutputFileExist() : bool
{
return $this->outputFileInfo !== null;
}
}

View File

@ -1,38 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject\FixtureSplit;
final class TrioContent
{
/**
* @var string
*/
private $firstValue;
/**
* @var string
*/
private $secondValue;
/**
* @var string
*/
private $expectedResult;
public function __construct(string $firstValue, string $secondValue, string $expectedResult)
{
$this->firstValue = $firstValue;
$this->secondValue = $secondValue;
$this->expectedResult = $expectedResult;
}
public function getFirstValue() : string
{
return $this->firstValue;
}
public function getSecondValue() : string
{
return $this->secondValue;
}
public function getExpectedResult() : string
{
return $this->expectedResult;
}
}

View File

@ -1,44 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
use Symplify\SmartFileSystem\SmartFileInfo;
final class IncorrectAndMissingSkips
{
/**
* @var SmartFileInfo[]
*/
private $incorrectSkipFileInfos;
/**
* @var SmartFileInfo[]
*/
private $missingSkipFileInfos;
/**
* @param SmartFileInfo[] $incorrectSkipFileInfos
* @param SmartFileInfo[] $missingSkipFileInfos
*/
public function __construct(array $incorrectSkipFileInfos, array $missingSkipFileInfos)
{
$this->incorrectSkipFileInfos = $incorrectSkipFileInfos;
$this->missingSkipFileInfos = $missingSkipFileInfos;
}
/**
* @return SmartFileInfo[]
*/
public function getIncorrectSkipFileInfos() : array
{
return $this->incorrectSkipFileInfos;
}
/**
* @return SmartFileInfo[]
*/
public function getMissingSkipFileInfos() : array
{
return $this->missingSkipFileInfos;
}
public function getFileCount() : int
{
return \count($this->missingSkipFileInfos) + \count($this->incorrectSkipFileInfos);
}
}

View File

@ -1,35 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
final class InputAndExpected
{
/**
* @var string
*/
private $input;
/**
* @var mixed
*/
private $expected;
/**
* @param mixed $expected
*/
public function __construct(string $input, $expected)
{
$this->input = $input;
$this->expected = $expected;
}
public function getInput() : string
{
return $this->input;
}
/**
* @return mixed
*/
public function getExpected()
{
return $this->expected;
}
}

View File

@ -1,47 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* @api
*/
final class InputFileInfoAndExpected
{
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo
*/
private $inputFileInfo;
/**
* @var mixed
*/
private $expected;
/**
* @param mixed $expected
*/
public function __construct(SmartFileInfo $inputFileInfo, $expected)
{
$this->inputFileInfo = $inputFileInfo;
$this->expected = $expected;
}
public function getInputFileContent() : string
{
return $this->inputFileInfo->getContents();
}
public function getInputFileInfo() : SmartFileInfo
{
return $this->inputFileInfo;
}
public function getInputFileRealPath() : string
{
return $this->inputFileInfo->getRealPath();
}
/**
* @return mixed
*/
public function getExpected()
{
return $this->expected;
}
}

View File

@ -1,41 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* @api
*/
final class InputFileInfoAndExpectedFileInfo
{
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo
*/
private $inputFileInfo;
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo
*/
private $expectedFileInfo;
public function __construct(SmartFileInfo $inputFileInfo, SmartFileInfo $expectedFileInfo)
{
$this->inputFileInfo = $inputFileInfo;
$this->expectedFileInfo = $expectedFileInfo;
}
public function getInputFileInfo() : SmartFileInfo
{
return $this->inputFileInfo;
}
public function getExpectedFileInfo() : SmartFileInfo
{
return $this->expectedFileInfo;
}
public function getExpectedFileContent() : string
{
return $this->expectedFileInfo->getContents();
}
public function getExpectedFileInfoRealPath() : string
{
return $this->expectedFileInfo->getRealPath();
}
}

View File

@ -1,12 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
final class Option
{
/**
* @var string
*/
public const SOURCE = 'source';
}

View File

@ -1,13 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
final class Prefix
{
/**
* @var string
* @see https://regex101.com/r/g4ozU6/1
*/
public const SKIP_PREFIX_REGEX = '#^(skip|keep)#i';
}

View File

@ -1,13 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\EasyTesting\ValueObject;
final class SplitLine
{
/**
* @see https://regex101.com/r/8fuULy/1
* @var string
*/
public const SPLIT_LINE_REGEX = "#\\-\\-\\-\\-\\-\r?\n#";
}

View File

@ -10,8 +10,7 @@
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/finder": "^6.0",
"symplify\/symplify-kernel": "^11.2",
"symplify\/easy-testing": "^11.2"
"symplify\/symplify-kernel": "^11.2"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"

View File

@ -8,7 +8,6 @@ use RectorPrefix202208\Symfony\Component\Console\Input\ArgvInput;
use RectorPrefix202208\Symfony\Component\Console\Output\ConsoleOutput;
use RectorPrefix202208\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202208\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix202208\Symplify\EasyTesting\PHPUnit\StaticPHPUnitEnvironment;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesCaller;
/**
* @api
@ -38,9 +37,16 @@ final class SymfonyStyleFactory
$consoleOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
}
// disable output for tests
if (StaticPHPUnitEnvironment::isPHPUnitRun()) {
if ($this->isPHPUnitRun()) {
$consoleOutput->setVerbosity(OutputInterface::VERBOSITY_QUIET);
}
return new SymfonyStyle($argvInput, $consoleOutput);
}
/**
* Never ever used static methods if not neccesary, this is just handy for tests + src to prevent duplication.
*/
private function isPHPUnitRun() : bool
{
return \defined('RectorPrefix202208\\PHPUNIT_COMPOSER_INSTALL') || \defined('RectorPrefix202208\\__PHPUNIT_PHAR__');
}
}