fix: package lock fingerprint

This commit is contained in:
nuno maduro
2026-07-18 01:10:01 +01:00
parent 9e79e491e2
commit 820fa08313
237 changed files with 2409 additions and 2100 deletions
+23 -21
View File
@@ -1,49 +1,51 @@
<?php
declare(strict_types=1);
use Pest\Support\Arr;
describe('last', function () {
it('should return false for an empty arary', function () {
describe('last', function (): void {
it('should return false for an empty arary', function (): void {
expect(Arr::last([]))->toBeFalse();
});
it('should return the last element for an array with a single element', function () {
it('should return the last element for an array with a single element', function (): void {
expect(Arr::last([1]))->toBe(1);
});
it('should return the last element for an array without changing the internal pointer', function () {
it('should return the last element for an array without changing the internal pointer', function (): void {
$array = [1, 2, 3];
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(1);
expect(Arr::last($array))->toBe(3)
->and(current($array))->toBe(1);
next($array);
expect(current($array))->toBe(2);
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(2);
expect(current($array))->toBe(2)
->and(Arr::last($array))->toBe(3)
->and(current($array))->toBe(2);
});
it('should return the last element for an associative array without changing the internal pointer', function () {
it('should return the last element for an associative array without changing the internal pointer', function (): void {
$array = ['first' => 1, 'second' => 2, 'third' => 3];
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(1);
expect(Arr::last($array))->toBe(3)
->and(current($array))->toBe(1);
next($array);
expect(current($array))->toBe(2);
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(2);
expect(current($array))->toBe(2)
->and(Arr::last($array))->toBe(3)
->and(current($array))->toBe(2);
});
it('should return the last element for an mixed key array without changing the internal pointer', function () {
it('should return the last element for an mixed key array without changing the internal pointer', function (): void {
$array = ['first' => 1, 2, 'third' => 3];
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(1);
expect(Arr::last($array))->toBe(3)
->and(current($array))->toBe(1);
next($array);
expect(current($array))->toBe(2);
expect(Arr::last($array))->toBe(3);
expect(current($array))->toBe(2);
expect(current($array))->toBe(2)
->and(Arr::last($array))->toBe(3)
->and(current($array))->toBe(2);
});
});
+2 -4
View File
@@ -2,10 +2,8 @@
use Pest\Support\Backtrace;
it('gets file name from called file', function () {
$a = function () {
return Backtrace::file();
};
it('gets file name from called file', function (): void {
$a = (fn (): string => Backtrace::file());
expect($a())->toBe(__FILE__);
});
+7 -7
View File
@@ -6,37 +6,37 @@ use Pest\TestSuite;
pest()->group('container');
beforeEach(function () {
beforeEach(function (): void {
$this->container = new Container;
});
it('exists')
->assertTrue(class_exists(Container::class));
it('gets an instance', function () {
it('gets an instance', function (): void {
$this->container->add(Container::class, $this->container);
expect($this->container->get(Container::class))->toBe($this->container);
});
test('autowire', function () {
test('autowire', function (): void {
expect($this->container->get(Container::class))->toBeInstanceOf(Container::class);
});
it('creates an instance and resolves parameters', function () {
it('creates an instance and resolves parameters', function (): void {
$this->container->add(Container::class, $this->container);
$instance = $this->container->get(ClassWithDependency::class);
expect($instance)->toBeInstanceOf(ClassWithDependency::class);
});
it('creates an instance and resolves also sub parameters', function () {
it('creates an instance and resolves also sub parameters', function (): void {
$this->container->add(Container::class, $this->container);
$instance = $this->container->get(ClassWithSubDependency::class);
expect($instance)->toBeInstanceOf(ClassWithSubDependency::class);
});
it('can resolve builtin value types', function () {
it('can resolve builtin value types', function (): void {
$this->container->add('rootPath', getcwd());
$this->container->add('testPath', 'tests');
@@ -44,7 +44,7 @@ it('can resolve builtin value types', function () {
expect($instance)->toBeInstanceOf(TestSuite::class);
});
it('cannot resolve a parameter without type', function () {
it('cannot resolve a parameter without type', function (): void {
$this->container->get(ClassWithoutTypeParameter::class);
})->throws(ShouldNotHappen::class);
+5 -3
View File
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use Pest\Support\DatasetInfo;
it('can check if dataset is defined inside a Datasets directory', function (string $file, bool $inside) {
it('can check if dataset is defined inside a Datasets directory', function (string $file, bool $inside): void {
expect(DatasetInfo::isInsideADatasetsDirectory($file))->toBe($inside);
})->with([
['file' => '/var/www/Datasets/project/tests/Datasets/Nested/Numbers.php', 'inside' => true],
@@ -17,7 +19,7 @@ it('can check if dataset is defined inside a Datasets directory', function (stri
['file' => '/var/www/project/tests/Features/Datasets.php', 'inside' => false],
]);
it('can check if dataset is defined inside a Datasets.php file', function (string $file, bool $inside) {
it('can check if dataset is defined inside a Datasets.php file', function (string $file, bool $inside): void {
expect(DatasetInfo::isADatasetsFile($file))->toBe($inside);
})->with([
['file' => '/var/www/project/tests/Datasets/Numbers.php', 'inside' => false],
@@ -27,7 +29,7 @@ it('can check if dataset is defined inside a Datasets.php file', function (strin
['file' => '/var/www/project/tests/Features/Datasets.php', 'inside' => true],
]);
it('computes the dataset scope', function (string $file, string $scope) {
it('computes the dataset scope', function (string $file, string $scope): void {
expect(DatasetInfo::scope($file))->toBe($scope);
})->with([
['file' => '/var/www/Datasets/project/tests/Datasets/Nested/Numbers.php', 'scope' => '/var/www/Datasets/project/tests'],
+3 -3
View File
@@ -2,8 +2,8 @@
use Pest\Support\ExceptionTrace;
it('ensures the given closures reports the correct class name', function () {
$closure = function () {
it('ensures the given closures reports the correct class name', function (): void {
$closure = function (): void {
throw new Exception('Call to undefined method P\Tests\IntentionallyNotExisting::testBasic().');
};
@@ -13,7 +13,7 @@ it('ensures the given closures reports the correct class name', function () {
'Call to undefined method Tests\IntentionallyNotExisting::testBasic().',
);
it('ensures the given closures reports the correct class name and suggests the [pest()] function', function () {
it('ensures the given closures reports the correct class name and suggests the [pest()] function', function (): void {
$this->get();
})->throws(
Error::class,
+2 -2
View File
@@ -2,7 +2,7 @@
use Pest\Support\HigherOrderMessage;
test('undefined method exceptions', function () {
test('undefined method exceptions', function (): void {
$message = new HigherOrderMessage(
__FILE__,
1,
@@ -10,7 +10,7 @@ test('undefined method exceptions', function () {
[]
);
expect(fn () => $message->call($this))->toThrow(function (ReflectionException $exception) {
expect(fn () => $message->call($this))->toThrow(function (ReflectionException $exception): void {
expect($exception)
->getMessage()->toBe('Call to undefined method PHPUnit\Framework\TestCase::foqwdqwd()')
->getLine()->toBe(1)
+8 -8
View File
@@ -2,16 +2,16 @@
use Pest\Support\Reflection;
it('gets file name from closure', function () {
$fileName = Reflection::getFileNameFromClosure(function () {});
it('gets file name from closure', function (): void {
$fileName = Reflection::getFileNameFromClosure(function (): void {});
expect($fileName)->toBe(__FILE__);
});
it('gets property values', function () {
it('gets property values', function (): void {
$class = new class
{
private $foo = 'bar';
private string $foo = 'bar';
};
$value = Reflection::getPropertyValue($class, 'foo');
@@ -51,24 +51,24 @@ class Qwe extends Asd
}
}
it('gets properties from classes', function () {
it('gets properties from classes', function (): void {
$reflectionClass = new ReflectionClass(Qwe::class);
$properties = Reflection::getPropertiesFromReflectionClass($reflectionClass);
$properties = array_map(fn ($property) => $property->getName(), $properties);
$properties = array_map(fn (ReflectionProperty $property) => $property->getName(), $properties);
expect($properties)->toBe([
'bar',
]);
});
it('gets methods from classes', function () {
it('gets methods from classes', function (): void {
$reflectionClass = new ReflectionClass(Qwe::class);
$methods = Reflection::getMethodsFromReflectionClass($reflectionClass);
$methods = array_map(fn ($method) => $method->getName(), $methods);
$methods = array_map(fn (ReflectionMethod $method) => $method->getName(), $methods);
expect($methods)->toBe([
'getBar',
+3 -1
View File
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use Pest\Support\Str;
it('evaluates the code', function ($evaluatable, $expected) {
it('evaluates the code', function (string $evaluatable, $expected): void {
$code = Str::evaluable($evaluatable);
expect($code)->toBe($expected);