mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: properties and methods documented
This commit is contained in:
@ -1429,6 +1429,8 @@
|
||||
PASS Tests\Unit\Support\Reflection
|
||||
✓ it gets file name from closure
|
||||
✓ it gets property values
|
||||
✓ it gets properties from classes
|
||||
✓ it gets methods from classes
|
||||
|
||||
PASS Tests\Unit\Support\Str
|
||||
✓ it evaluates the code with ('version()', '__pest_evaluable_version__')
|
||||
@ -1535,4 +1537,4 @@
|
||||
WARN Tests\Visual\Version
|
||||
- visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1074 passed (2626 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1076 passed (2628 assertions)
|
||||
@ -18,3 +18,59 @@ it('gets property values', function () {
|
||||
|
||||
expect($value)->toBe('bar');
|
||||
});
|
||||
|
||||
class Asd
|
||||
{
|
||||
protected $foo = 'bar';
|
||||
|
||||
public function getFoo()
|
||||
{
|
||||
return $this->foo;
|
||||
}
|
||||
}
|
||||
|
||||
trait Zxc
|
||||
{
|
||||
protected $baz = 'qux';
|
||||
|
||||
public function getBaz()
|
||||
{
|
||||
return $this->baz;
|
||||
}
|
||||
}
|
||||
|
||||
class Qwe extends Asd
|
||||
{
|
||||
use Zxc;
|
||||
|
||||
protected $bar = 'baz';
|
||||
|
||||
public function getBar()
|
||||
{
|
||||
return $this->bar;
|
||||
}
|
||||
}
|
||||
|
||||
it('gets properties from classes', function () {
|
||||
$reflectionClass = new ReflectionClass(Qwe::class);
|
||||
|
||||
$properties = Reflection::getPropertiesFromReflectionClass($reflectionClass);
|
||||
|
||||
$properties = array_map(fn ($property) => $property->getName(), $properties);
|
||||
|
||||
expect($properties)->toBe([
|
||||
'bar',
|
||||
]);
|
||||
});
|
||||
|
||||
it('gets methods from classes', function () {
|
||||
$reflectionClass = new ReflectionClass(Qwe::class);
|
||||
|
||||
$methods = Reflection::getMethodsFromReflectionClass($reflectionClass);
|
||||
|
||||
$methods = array_map(fn ($method) => $method->getName(), $methods);
|
||||
|
||||
expect($methods)->toBe([
|
||||
'getBar',
|
||||
]);
|
||||
});
|
||||
|
||||
@ -16,7 +16,7 @@ $run = function () {
|
||||
|
||||
test('parallel', function () use ($run) {
|
||||
expect($run('--exclude-group=integration'))
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1060 passed (2594 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 1062 passed (2596 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user