mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Merge branch 'master' into fix-missing-dataset-errors
This commit is contained in:
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [v1.7.1 (2021-06-24)](https://github.com/pestphp/pest/compare/v1.7.0...v1.7.1)
|
||||||
|
### Fixed
|
||||||
|
- The `and` method not being usable in Higher Order expectations ([#330](https://github.com/pestphp/pest/pull/330))
|
||||||
|
|
||||||
## [v1.7.0 (2021-06-19)](https://github.com/pestphp/pest/compare/v1.6.0...v1.7.0)
|
## [v1.7.0 (2021-06-19)](https://github.com/pestphp/pest/compare/v1.6.0...v1.7.0)
|
||||||
### Added
|
### Added
|
||||||
- Support for non-callable values in the sequence method, which will be passed as `toEqual` ([#323](https://github.com/pestphp/pest/pull/323))
|
- Support for non-callable values in the sequence method, which will be passed as `toEqual` ([#323](https://github.com/pestphp/pest/pull/323))
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
"php": "^7.3 || ^8.0",
|
"php": "^7.3 || ^8.0",
|
||||||
"nunomaduro/collision": "^5.4.0",
|
"nunomaduro/collision": "^5.4.0",
|
||||||
"pestphp/pest-plugin": "^1.0.0",
|
"pestphp/pest-plugin": "^1.0.0",
|
||||||
"phpunit/phpunit": ">= 9.3.7 <= 9.5.5"
|
"phpunit/phpunit": ">= 9.3.7 <= 9.5.6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
@ -63,6 +63,20 @@ final class HigherOrderExpectation
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new expectation.
|
||||||
|
*
|
||||||
|
* @template TValue
|
||||||
|
*
|
||||||
|
* @param TValue $value
|
||||||
|
*
|
||||||
|
* @return Expectation<TValue>
|
||||||
|
*/
|
||||||
|
public function and($value): Expectation
|
||||||
|
{
|
||||||
|
return $this->expect($value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically calls methods on the class with the given arguments.
|
* Dynamically calls methods on the class with the given arguments.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '1.7.0';
|
return '1.7.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDirectory(string $file = ''): string
|
function testDirectory(string $file = ''): string
|
||||||
|
|||||||
@ -116,6 +116,7 @@
|
|||||||
PASS Tests\Features\Expect\HigherOrder\methodsAndProperties
|
PASS Tests\Features\Expect\HigherOrder\methodsAndProperties
|
||||||
✓ it can access methods and properties
|
✓ it can access methods and properties
|
||||||
✓ it can handle nested methods and properties
|
✓ it can handle nested methods and properties
|
||||||
|
✓ it can start a new higher order expectation using the and syntax
|
||||||
|
|
||||||
PASS Tests\Features\Expect\HigherOrder\properties
|
PASS Tests\Features\Expect\HigherOrder\properties
|
||||||
✓ it allows properties to be accessed from the value
|
✓ it allows properties to be accessed from the value
|
||||||
|
|||||||
@ -22,6 +22,17 @@ it('can handle nested methods and properties', function () {
|
|||||||
->newInstance()->books()->toBeArray();
|
->newInstance()->books()->toBeArray();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can start a new higher order expectation using the and syntax', function () {
|
||||||
|
expect(new HasMethodsAndProperties())
|
||||||
|
->toBeInstanceOf(HasMethodsAndProperties::class)
|
||||||
|
->meta->toBeArray
|
||||||
|
->and(['foo' => 'bar'])
|
||||||
|
->toBeArray()
|
||||||
|
->foo->toEqual('bar');
|
||||||
|
|
||||||
|
expect(static::getCount())->toEqual(4);
|
||||||
|
});
|
||||||
|
|
||||||
class HasMethodsAndProperties
|
class HasMethodsAndProperties
|
||||||
{
|
{
|
||||||
public $name = 'Has Methods and Properties';
|
public $name = 'Has Methods and Properties';
|
||||||
|
|||||||
Reference in New Issue
Block a user