mirror of
https://github.com/pestphp/pest.git
synced 2026-07-24 10:30:03 +02:00
fix: package lock fingerprint
This commit is contained in:
@@ -1,50 +1,50 @@
|
||||
<?php
|
||||
|
||||
it('allows properties to be accessed from the value', function () {
|
||||
it('allows properties to be accessed from the value', function (): void {
|
||||
expect(['foo' => 1])->foo->toBeInt()->toEqual(1);
|
||||
});
|
||||
|
||||
it('can access multiple properties from the value', function () {
|
||||
it('can access multiple properties from the value', function (): void {
|
||||
expect(['foo' => 'bar', 'hello' => 'world'])
|
||||
->foo->toBeString()->toEqual('bar')
|
||||
->hello->toBeString()->toEqual('world');
|
||||
});
|
||||
|
||||
it('works with not', function () {
|
||||
it('works with not', function (): void {
|
||||
expect(['foo' => 'bar', 'hello' => 'world'])
|
||||
->foo->not->not->toEqual('bar')
|
||||
->foo->not->toEqual('world')->toEqual('bar')
|
||||
->hello->toEqual('world')->not()->toEqual('bar')->not->toBeNull;
|
||||
});
|
||||
|
||||
it('works with each', function () {
|
||||
it('works with each', function (): void {
|
||||
expect(['numbers' => [1, 2, 3, 4], 'words' => ['hey', 'there']])
|
||||
->numbers->toEqual([1, 2, 3, 4])->each->toBeInt->toBeLessThan(5)
|
||||
->words->each(function ($word) {
|
||||
->words->each(function ($word): void {
|
||||
$word->toBeString()->not->toBeInt();
|
||||
});
|
||||
});
|
||||
|
||||
it('works inside of each', function () {
|
||||
it('works inside of each', function (): void {
|
||||
expect(['books' => [['title' => 'Foo', 'cost' => 20], ['title' => 'Bar', 'cost' => 30]]])
|
||||
->books->each(function ($book) {
|
||||
->books->each(function ($book): void {
|
||||
$book->title->not->toBeNull->cost->toBeGreaterThan(19);
|
||||
});
|
||||
});
|
||||
|
||||
it('works with sequence', function () {
|
||||
it('works with sequence', function (): void {
|
||||
expect(['books' => [['title' => 'Foo', 'cost' => 20], ['title' => 'Bar', 'cost' => 30]]])
|
||||
->books->sequence(
|
||||
function ($book) {
|
||||
function ($book): void {
|
||||
$book->title->toEqual('Foo')->cost->toEqual(20);
|
||||
},
|
||||
function ($book) {
|
||||
function ($book): void {
|
||||
$book->title->toEqual('Bar')->cost->toEqual(30);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('can compose complex expectations', function () {
|
||||
it('can compose complex expectations', function (): void {
|
||||
expect(['foo' => 'bar', 'numbers' => [1, 2, 3, 4]])
|
||||
->toContain('bar')->toBeArray()
|
||||
->numbers->toEqual([1, 2, 3, 4])->not()->toEqual('bar')->each->toBeInt
|
||||
@@ -52,23 +52,23 @@ it('can compose complex expectations', function () {
|
||||
->numbers->toBeArray();
|
||||
});
|
||||
|
||||
it('works with objects', function () {
|
||||
it('works with objects', function (): void {
|
||||
expect(new HasProperties)
|
||||
->name->toEqual('foo')->not->toEqual('world')
|
||||
->posts->toHaveCount(2)->each(function ($post) {
|
||||
->posts->toHaveCount(2)->each(function ($post): void {
|
||||
$post->is_published->toBeTrue();
|
||||
})
|
||||
->posts->sequence(
|
||||
function ($post) {
|
||||
function ($post): void {
|
||||
$post->title->toEqual('Foo');
|
||||
},
|
||||
function ($post) {
|
||||
function ($post): void {
|
||||
$post->title->toEqual('Bar');
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('works with nested properties', function () {
|
||||
it('works with nested properties', function (): void {
|
||||
expect(new HasProperties)
|
||||
->nested->foo->bar->toBeString()->toEqual('baz')
|
||||
->posts->toBeArray()->toHaveCount(2);
|
||||
|
||||
Reference in New Issue
Block a user