mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
feat: inline testing
This commit is contained in:
18
src/NotExported/MyTestCase.php
Normal file
18
src/NotExported/MyTestCase.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\NotExported;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class MyTestCase extends TestCase // @phpstan-ignore-line
|
||||
{
|
||||
public function assertIsTestable(string $testable): void
|
||||
{
|
||||
static::assertSame(MyTestableClass::class, $testable);
|
||||
}
|
||||
}
|
||||
22
src/NotExported/MyTestableClass.php
Normal file
22
src/NotExported/MyTestableClass.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\NotExported;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class MyTestableClass
|
||||
{
|
||||
public function foo(): void
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
it('foo', function () {
|
||||
$testable = new MyTestableClass();
|
||||
|
||||
$this->assertIsTestable(get_class($testable)); // @phpstan-ignore-line
|
||||
});
|
||||
@ -23,7 +23,7 @@ final class Plugin
|
||||
public static function uses(string ...$traits): void
|
||||
{
|
||||
self::$callables[] = function () use ($traits): void {
|
||||
uses(...$traits)->in(TestSuite::getInstance()->rootPath.DIRECTORY_SEPARATOR.testDirectory());
|
||||
uses(...$traits)->in(TestSuite::getInstance()->rootPath);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user