mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
first
This commit is contained in:
11
tests/Unit/Support/Backtrace.php
Normal file
11
tests/Unit/Support/Backtrace.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Pest\Support\Backtrace;
|
||||
|
||||
it('gets file name from called file', function () {
|
||||
$a = function () {
|
||||
return Backtrace::file();
|
||||
};
|
||||
|
||||
assertEquals(__FILE__, $a());
|
||||
});
|
||||
19
tests/Unit/Support/Reflection.php
Normal file
19
tests/Unit/Support/Reflection.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Pest\Support\Reflection;
|
||||
|
||||
it('gets file name from closure', function () {
|
||||
$fileName = Reflection::getFileNameFromClosure(function () {});
|
||||
|
||||
assertEquals(__FILE__, $fileName);
|
||||
});
|
||||
|
||||
it('gets property values', function () {
|
||||
$class = new class() {
|
||||
private $foo = 'bar';
|
||||
};
|
||||
|
||||
$value = Reflection::getPropertyValue($class, 'foo');
|
||||
|
||||
assertEquals('bar', $value);
|
||||
});
|
||||
Reference in New Issue
Block a user