mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
chore: style changes
This commit is contained in:
@ -1,29 +1,29 @@
|
||||
<?php
|
||||
|
||||
it('can access methods', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->name()->toBeString()->toEqual('Has Methods');
|
||||
});
|
||||
|
||||
it('can access multiple methods', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->name()->toBeString()->toEqual('Has Methods')
|
||||
->quantity()->toBeInt()->toEqual(20);
|
||||
});
|
||||
|
||||
it('works with not', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->name()->not->toEqual('world')->toEqual('Has Methods')
|
||||
->quantity()->toEqual(20)->not()->toEqual('bar')->not->toBeNull;
|
||||
});
|
||||
|
||||
it('can accept arguments', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->multiply(5, 4)->toBeInt->toEqual(20);
|
||||
});
|
||||
|
||||
it('works with each', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->attributes()->toBeArray->each->not()->toBeNull
|
||||
->attributes()->each(function ($attribute) {
|
||||
$attribute->not->toBeNull();
|
||||
@ -31,14 +31,14 @@ it('works with each', function () {
|
||||
});
|
||||
|
||||
it('works inside of each', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->books()->each(function ($book) {
|
||||
$book->title->not->toBeNull->cost->toBeGreaterThan(19);
|
||||
});
|
||||
});
|
||||
|
||||
it('works with sequence', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->books()->sequence(
|
||||
function ($book) {
|
||||
$book->title->toEqual('Foo')->cost->toEqual(20);
|
||||
@ -50,7 +50,7 @@ it('works with sequence', function () {
|
||||
});
|
||||
|
||||
it('can compose complex expectations', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->toBeObject()
|
||||
->name()->toEqual('Has Methods')->not()->toEqual('bar')
|
||||
->quantity()->not->toEqual('world')->toEqual(20)->toBeInt
|
||||
@ -68,7 +68,7 @@ it('can compose complex expectations', function () {
|
||||
});
|
||||
|
||||
it('can handle nested method calls', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->newInstance()->newInstance()->name()->toEqual('Has Methods')->toBeString()
|
||||
->newInstance()->name()->toEqual('Has Methods')->not->toBeInt
|
||||
->name()->toEqual('Has Methods')
|
||||
@ -76,14 +76,14 @@ it('can handle nested method calls', function () {
|
||||
});
|
||||
|
||||
it('works with higher order tests')
|
||||
->expect(new HasMethods())
|
||||
->expect(new HasMethods)
|
||||
->newInstance()->newInstance()->name()->toEqual('Has Methods')->toBeString()
|
||||
->newInstance()->name()->toEqual('Has Methods')->not->toBeArray
|
||||
->name()->toEqual('Has Methods')
|
||||
->books()->each->toBeArray;
|
||||
|
||||
it('can use the scoped method to lock into the given level for expectations', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->attributes()->scoped(fn ($attributes) => $attributes
|
||||
->name->toBe('Has Methods')
|
||||
->quantity->toBe(20)
|
||||
@ -100,7 +100,7 @@ it('can use the scoped method to lock into the given level for expectations', fu
|
||||
});
|
||||
|
||||
it('works consistently with the json expectation method', function () {
|
||||
expect(new HasMethods())
|
||||
expect(new HasMethods)
|
||||
->jsonString()->json()->id->toBe(1)
|
||||
->jsonString()->json()->name->toBe('Has Methods')->toBeString()
|
||||
->jsonString()->json()->quantity->toBe(20)->toBeInt();
|
||||
@ -152,6 +152,6 @@ class HasMethods
|
||||
|
||||
public function newInstance()
|
||||
{
|
||||
return new static();
|
||||
return new static;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user