composer vendor update and .env file fixes, remove debug echo
No more echo for any debug logging Update .env file sample data
This commit is contained in:
9
www/vendor/phpunit/phpunit/ChangeLog-9.5.md
vendored
9
www/vendor/phpunit/phpunit/ChangeLog-9.5.md
vendored
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [9.5.19] - 2022-03-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4929](https://github.com/sebastianbergmann/phpunit/issues/4929): Test Double code generator does not handle new expressions inside parameter default values
|
||||
* [#4932](https://github.com/sebastianbergmann/phpunit/issues/4932): Backport support for intersection types from PHPUnit 10 to PHPUnit 9.5
|
||||
* [#4933](https://github.com/sebastianbergmann/phpunit/issues/4933): Backport support for `never` type from PHPUnit 10 to PHPUnit 9.5
|
||||
|
||||
## [9.5.18] - 2022-03-08
|
||||
|
||||
### Fixed
|
||||
@@ -142,6 +150,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil
|
||||
|
||||
* [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly
|
||||
|
||||
[9.5.19]: https://github.com/sebastianbergmann/phpunit/compare/9.5.18...9.5.19
|
||||
[9.5.18]: https://github.com/sebastianbergmann/phpunit/compare/9.5.17...9.5.18
|
||||
[9.5.17]: https://github.com/sebastianbergmann/phpunit/compare/9.5.16...9.5.17
|
||||
[9.5.16]: https://github.com/sebastianbergmann/phpunit/compare/dc738383c519243b0a967f63943a848d3fd861aa...9.5.16
|
||||
|
||||
2
www/vendor/phpunit/phpunit/composer.json
vendored
2
www/vendor/phpunit/phpunit/composer.json
vendored
@@ -47,7 +47,7 @@
|
||||
"sebastian/global-state": "^5.0.1",
|
||||
"sebastian/object-enumerator": "^4.0.3",
|
||||
"sebastian/resource-operations": "^3.0.3",
|
||||
"sebastian/type": "^2.3.4",
|
||||
"sebastian/type": "^3.0",
|
||||
"sebastian/version": "^3.0.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
@@ -171,6 +171,67 @@ final class Generator
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<class-string> $interfaces
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws UnknownTypeException
|
||||
*/
|
||||
public function getMockForInterfaces(array $interfaces, bool $callAutoload = true): MockObject
|
||||
{
|
||||
if (count($interfaces) < 2) {
|
||||
throw new RuntimeException('At least two interfaces must be specified');
|
||||
}
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
if (!interface_exists($interface, $callAutoload)) {
|
||||
throw new UnknownTypeException($interface);
|
||||
}
|
||||
}
|
||||
|
||||
sort($interfaces);
|
||||
|
||||
$methods = [];
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
$methods = array_merge($methods, $this->getClassMethods($interface));
|
||||
}
|
||||
|
||||
if (count(array_unique($methods)) < count($methods)) {
|
||||
throw new RuntimeException('Interfaces must not declare the same method');
|
||||
}
|
||||
|
||||
$unqualifiedNames = [];
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
$parts = explode('\\', $interface);
|
||||
$unqualifiedNames[] = array_pop($parts);
|
||||
}
|
||||
|
||||
sort($unqualifiedNames);
|
||||
|
||||
do {
|
||||
$intersectionName = sprintf(
|
||||
'Intersection_%s_%s',
|
||||
implode('_', $unqualifiedNames),
|
||||
substr(md5((string) mt_rand()), 0, 8)
|
||||
);
|
||||
} while (interface_exists($intersectionName, false));
|
||||
|
||||
$template = $this->getTemplate('intersection.tpl');
|
||||
|
||||
$template->setVar(
|
||||
[
|
||||
'intersection' => $intersectionName,
|
||||
'interfaces' => implode(', ', $interfaces),
|
||||
]
|
||||
);
|
||||
|
||||
eval($template->render());
|
||||
|
||||
return $this->getMock($intersectionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock object for the specified abstract class with all abstract
|
||||
* methods of the class mocked.
|
||||
|
||||
5
www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl
vendored
Normal file
5
www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
interface {intersection} extends {interfaces}
|
||||
{
|
||||
}
|
||||
@@ -121,100 +121,141 @@ final class Invocation implements SelfDescribing
|
||||
return null;
|
||||
}
|
||||
|
||||
$union = false;
|
||||
$intersection = false;
|
||||
$union = false;
|
||||
|
||||
if (strpos($this->returnType, '|') !== false) {
|
||||
$types = explode('|', $this->returnType);
|
||||
$union = true;
|
||||
} elseif (strpos($this->returnType, '&') !== false) {
|
||||
$types = explode('&', $this->returnType);
|
||||
$intersection = true;
|
||||
} else {
|
||||
$types = [$this->returnType];
|
||||
}
|
||||
|
||||
$types = array_map('strtolower', $types);
|
||||
|
||||
if (in_array('', $types, true) ||
|
||||
in_array('null', $types, true) ||
|
||||
in_array('mixed', $types, true) ||
|
||||
in_array('void', $types, true)) {
|
||||
return null;
|
||||
}
|
||||
if (!$intersection) {
|
||||
if (in_array('', $types, true) ||
|
||||
in_array('null', $types, true) ||
|
||||
in_array('mixed', $types, true) ||
|
||||
in_array('void', $types, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (in_array('false', $types, true) ||
|
||||
in_array('bool', $types, true)) {
|
||||
return false;
|
||||
}
|
||||
if (in_array('false', $types, true) ||
|
||||
in_array('bool', $types, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_array('float', $types, true)) {
|
||||
return 0.0;
|
||||
}
|
||||
if (in_array('float', $types, true)) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (in_array('int', $types, true)) {
|
||||
return 0;
|
||||
}
|
||||
if (in_array('int', $types, true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (in_array('string', $types, true)) {
|
||||
return '';
|
||||
}
|
||||
if (in_array('string', $types, true)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (in_array('array', $types, true)) {
|
||||
return [];
|
||||
}
|
||||
if (in_array('array', $types, true)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (in_array('static', $types, true)) {
|
||||
try {
|
||||
return (new Instantiator)->instantiate(get_class($this->object));
|
||||
} catch (Throwable $t) {
|
||||
throw new RuntimeException(
|
||||
$t->getMessage(),
|
||||
(int) $t->getCode(),
|
||||
$t
|
||||
);
|
||||
if (in_array('static', $types, true)) {
|
||||
try {
|
||||
return (new Instantiator)->instantiate(get_class($this->object));
|
||||
} catch (Throwable $t) {
|
||||
throw new RuntimeException(
|
||||
$t->getMessage(),
|
||||
(int) $t->getCode(),
|
||||
$t
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('object', $types, true)) {
|
||||
return new stdClass;
|
||||
}
|
||||
|
||||
if (in_array('callable', $types, true) ||
|
||||
in_array('closure', $types, true)) {
|
||||
return static function (): void
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
if (in_array('traversable', $types, true) ||
|
||||
in_array('generator', $types, true) ||
|
||||
in_array('iterable', $types, true)) {
|
||||
$generator = static function (): \Generator
|
||||
{
|
||||
yield from [];
|
||||
};
|
||||
|
||||
return $generator();
|
||||
}
|
||||
|
||||
if (!$union) {
|
||||
try {
|
||||
return (new Generator)->getMock($this->returnType, [], [], '', false);
|
||||
} catch (Throwable $t) {
|
||||
if ($t instanceof Exception) {
|
||||
throw $t;
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
$t->getMessage(),
|
||||
(int) $t->getCode(),
|
||||
$t
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('object', $types, true)) {
|
||||
return new stdClass;
|
||||
}
|
||||
$reason = '';
|
||||
|
||||
if (in_array('callable', $types, true) ||
|
||||
in_array('closure', $types, true)) {
|
||||
return static function (): void
|
||||
{
|
||||
};
|
||||
}
|
||||
if ($union) {
|
||||
$reason = ' because the declared return type is a union';
|
||||
} elseif ($intersection) {
|
||||
$reason = ' because the declared return type is an intersection';
|
||||
|
||||
if (in_array('traversable', $types, true) ||
|
||||
in_array('generator', $types, true) ||
|
||||
in_array('iterable', $types, true)) {
|
||||
$generator = static function (): \Generator
|
||||
{
|
||||
yield from [];
|
||||
};
|
||||
$onlyInterfaces = true;
|
||||
|
||||
return $generator();
|
||||
}
|
||||
foreach ($types as $type) {
|
||||
if (!interface_exists($type)) {
|
||||
$onlyInterfaces = false;
|
||||
|
||||
if (!$union) {
|
||||
try {
|
||||
return (new Generator)->getMock($this->returnType, [], [], '', false);
|
||||
} catch (Throwable $t) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Return value for %s::%s() cannot be generated: %s',
|
||||
$this->className,
|
||||
$this->methodName,
|
||||
$t->getMessage(),
|
||||
),
|
||||
(int) $t->getCode(),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($onlyInterfaces) {
|
||||
try {
|
||||
return (new Generator)->getMockForInterfaces($types);
|
||||
} catch (Throwable $t) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Return value for %s::%s() cannot be generated: %s',
|
||||
$this->className,
|
||||
$this->methodName,
|
||||
$t->getMessage(),
|
||||
),
|
||||
(int) $t->getCode(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Return value for %s::%s() cannot be generated because the declared return type is a union, please configure a return value for this method',
|
||||
'Return value for %s::%s() cannot be generated%s, please configure a return value for this method',
|
||||
$this->className,
|
||||
$this->methodName
|
||||
$this->methodName,
|
||||
$reason
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,20 @@
|
||||
namespace PHPUnit\Framework\MockObject;
|
||||
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function is_object;
|
||||
use function is_string;
|
||||
use function preg_match;
|
||||
use function preg_replace;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function substr;
|
||||
use function substr_count;
|
||||
use function trim;
|
||||
use function var_export;
|
||||
use ReflectionIntersectionType;
|
||||
use ReflectionMethod;
|
||||
use ReflectionNamedType;
|
||||
use ReflectionParameter;
|
||||
@@ -27,7 +33,6 @@ use SebastianBergmann\Template\Template;
|
||||
use SebastianBergmann\Type\ReflectionMapper;
|
||||
use SebastianBergmann\Type\Type;
|
||||
use SebastianBergmann\Type\UnknownType;
|
||||
use SebastianBergmann\Type\VoidType;
|
||||
|
||||
/**
|
||||
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
||||
@@ -134,7 +139,7 @@ final class MockMethod
|
||||
$modifier,
|
||||
self::getMethodParametersForDeclaration($method),
|
||||
self::getMethodParametersForCall($method),
|
||||
(new ReflectionMapper)->fromMethodReturnType($method),
|
||||
(new ReflectionMapper)->fromReturnType($method),
|
||||
$reference,
|
||||
$callOriginalMethod,
|
||||
$method->isStatic(),
|
||||
@@ -186,9 +191,9 @@ final class MockMethod
|
||||
{
|
||||
if ($this->static) {
|
||||
$templateFile = 'mocked_static_method.tpl';
|
||||
} elseif ($this->returnType instanceof VoidType) {
|
||||
} elseif ($this->returnType->isNever() || $this->returnType->isVoid()) {
|
||||
$templateFile = sprintf(
|
||||
'%s_method_void.tpl',
|
||||
'%s_method_never_or_void.tpl',
|
||||
$this->callOriginalMethod ? 'proxied' : 'mocked'
|
||||
);
|
||||
} else {
|
||||
@@ -304,7 +309,7 @@ final class MockMethod
|
||||
}
|
||||
|
||||
if ($type !== null) {
|
||||
if ($typeName !== 'mixed' && $parameter->allowsNull() && !$type instanceof ReflectionUnionType) {
|
||||
if ($typeName !== 'mixed' && $parameter->allowsNull() && !$type instanceof ReflectionIntersectionType && !$type instanceof ReflectionUnionType) {
|
||||
$nullable = '?';
|
||||
}
|
||||
|
||||
@@ -317,6 +322,8 @@ final class MockMethod
|
||||
$type,
|
||||
$method->getDeclaringClass()->getName()
|
||||
);
|
||||
} elseif ($type instanceof ReflectionIntersectionType) {
|
||||
$typeDeclaration = self::intersectionTypeAsString($type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +376,25 @@ final class MockMethod
|
||||
private static function exportDefaultValue(ReflectionParameter $parameter): string
|
||||
{
|
||||
try {
|
||||
return (string) var_export($parameter->getDefaultValue(), true);
|
||||
$defaultValue = $parameter->getDefaultValue();
|
||||
|
||||
if (!is_object($defaultValue)) {
|
||||
return (string) var_export($defaultValue, true);
|
||||
}
|
||||
|
||||
$parameterAsString = $parameter->__toString();
|
||||
|
||||
return (string) explode(
|
||||
' = ',
|
||||
substr(
|
||||
substr(
|
||||
$parameterAsString,
|
||||
strpos($parameterAsString, '<optional> ') + strlen('<optional> ')
|
||||
),
|
||||
0,
|
||||
-2
|
||||
)
|
||||
)[1];
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
@@ -395,4 +420,15 @@ final class MockMethod
|
||||
|
||||
return implode('|', $types) . ' ';
|
||||
}
|
||||
|
||||
private static function intersectionTypeAsString(ReflectionIntersectionType $intersection): string
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($intersection->getTypes() as $type) {
|
||||
$types[] = $type;
|
||||
}
|
||||
|
||||
return implode('&', $types) . ' ';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ final class Version
|
||||
}
|
||||
|
||||
if (self::$version === '') {
|
||||
self::$version = (new VersionId('9.5.18', dirname(__DIR__, 2)))->getVersion();
|
||||
self::$version = (new VersionId('9.5.19', dirname(__DIR__, 2)))->getVersion();
|
||||
}
|
||||
|
||||
return self::$version;
|
||||
|
||||
Reference in New Issue
Block a user