mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: more expectations
This commit is contained in:
@ -479,6 +479,27 @@ final class Expectation
|
|||||||
return $this->toBeEnum();
|
return $this->toBeEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the given expectation targets is an class.
|
||||||
|
*/
|
||||||
|
public function toBeClass(): ArchExpectation
|
||||||
|
{
|
||||||
|
return Targeted::make(
|
||||||
|
$this,
|
||||||
|
fn (ObjectDescription $object): bool => class_exists($object->name),
|
||||||
|
'to be class',
|
||||||
|
FileLineFinder::where(fn (string $line): bool => true),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the given expectation targets are classes.
|
||||||
|
*/
|
||||||
|
public function toBeClasses(): ArchExpectation
|
||||||
|
{
|
||||||
|
return $this->toBeClass();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the given expectation target is interface.
|
* Asserts that the given expectation target is interface.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -30,4 +30,4 @@ test('contracts')
|
|||||||
'NunoMaduro\Collision\Contracts',
|
'NunoMaduro\Collision\Contracts',
|
||||||
'Pest\Factories\TestCaseMethodFactory',
|
'Pest\Factories\TestCaseMethodFactory',
|
||||||
'Symfony\Component\Console',
|
'Symfony\Component\Console',
|
||||||
]);
|
])->toBeInterfaces();
|
||||||
|
|||||||
Reference in New Issue
Block a user