mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 01:07:23 +01:00
Merge branch 'master' into scoped
# Conflicts: # src/Expectations/HigherOrderExpectation.php # tests/Features/Expect/HigherOrder/methods.php
This commit is contained in:
@ -62,7 +62,7 @@ final class Expectation
|
||||
/**
|
||||
* Creates a new expectation with the decoded JSON value.
|
||||
*
|
||||
* @return self<mixed>
|
||||
* @return self<array<int|string, mixed>|bool>
|
||||
*/
|
||||
public function json(): Expectation
|
||||
{
|
||||
@ -70,7 +70,10 @@ final class Expectation
|
||||
InvalidExpectationValue::expected('string');
|
||||
}
|
||||
|
||||
return $this->toBeJson()->and(json_decode($this->value, true));
|
||||
/** @var array<int|string, mixed>|bool $value */
|
||||
$value = json_decode($this->value, true);
|
||||
|
||||
return $this->toBeJson()->and($value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -95,6 +95,16 @@ final class HigherOrderExpectation
|
||||
return new self($this->original, $this->original->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation with the decoded JSON value.
|
||||
*
|
||||
* @return self<TOriginalValue, array<string|int, mixed>|bool>
|
||||
*/
|
||||
public function json(): self
|
||||
{
|
||||
return new self($this->original, $this->expectation->json()->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically calls methods on the class with the given arguments.
|
||||
*
|
||||
|
||||
@ -52,9 +52,9 @@ final class HigherOrderCallables
|
||||
}
|
||||
|
||||
/**
|
||||
* Tap into the test case to perform an action and return the test case.
|
||||
* Execute the given callable after the test has executed the setup method.
|
||||
*/
|
||||
public function tap(callable $callable): object
|
||||
public function defer(callable $callable): object
|
||||
{
|
||||
Reflection::bindCallableWithData($callable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user