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
+25 -46
View File
@@ -2,50 +2,42 @@
use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () {
beforeEach(function (): void {
$this->whenObject = new stdClass;
$this->whenObject->trueValue = true;
$this->whenObject->foo = 'foo';
});
it('pass', function () {
it('pass', function (): void {
expect('foo')
->when(
true,
function ($value) {
return $value->toEqual('foo');
}
fn ($value) => $value->toEqual('foo')
)
->toEqual('foo');
expect(static::getCount())->toBe(2);
->toEqual('foo')
->and(static::getCount())->toBe(2);
});
it('failures', function () {
it('failures', function (): void {
expect('foo')
->when(
true,
function ($value) {
return $value->toBeTrue();
}
fn ($value) => $value->toBeTrue()
)
->toEqual('foo');
})->throws(ExpectationFailedException::class, 'is true');
it('runs with truthy', function () {
it('runs with truthy', function (): void {
expect($this->whenObject)
->when(
1,
function ($value) {
return $value->trueValue->toBeTrue();
}
fn ($value) => $value->trueValue->toBeTrue()
)
->foo->toEqual('foo');
expect(static::getCount())->toBe(2);
->foo->toEqual('foo')
->and(static::getCount())->toBe(2);
});
it('skips with falsy', function () {
it('skips with falsy', function (): void {
expect($this->whenObject)
->when(
0,
@@ -59,49 +51,36 @@ it('skips with falsy', function () {
return $value->trueValue->toBeFalse(); // fails
}
)
->foo->toEqual('foo');
expect(static::getCount())->toBe(1);
->foo->toEqual('foo')
->and(static::getCount())->toBe(1);
});
it('runs with truthy closure condition', function () {
it('runs with truthy closure condition', function (): void {
expect($this->whenObject)
->when(
function () {
return '1';
},
function ($value) {
return $value->trueValue->toBeTrue();
}
fn (): string => '1',
fn ($value) => $value->trueValue->toBeTrue()
)
->foo->toEqual('foo');
expect(static::getCount())->toBe(2);
->foo->toEqual('foo')
->and(static::getCount())->toBe(2);
});
it('skips with falsy closure condition', function () {
it('skips with falsy closure condition', function (): void {
expect($this->whenObject)
->when(
function () {
return '0';
},
fn (): string => '0',
function ($value) {
return $value->trueValue->toBeFalse(); // fails
}
)
->foo->toEqual('foo');
expect(static::getCount())->toBe(1);
->foo->toEqual('foo')
->and(static::getCount())->toBe(1);
});
it('can be used in higher order tests')
->expect(false)
->when(
function () {
return true;
},
function ($value) {
return $value->toBeTrue();
}
fn (): true => true,
fn ($value) => $value->toBeTrue()
)
->throws(ExpectationFailedException::class, 'false is true');