mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
Adding tests
This commit is contained in:
@ -6,6 +6,7 @@ use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Fixtures\Covers\CoversClass1;
|
||||
use Tests\Fixtures\Covers\CoversClass2;
|
||||
use Tests\Fixtures\Covers\CoversClass3;
|
||||
use Tests\Fixtures\Covers\CoversTrait;
|
||||
|
||||
$runCounter = 0;
|
||||
|
||||
@ -43,6 +44,13 @@ it('guesses if the given argument is a class or function', function () {
|
||||
expect($attributes[3]->getArguments()[0])->toBe(CoversClass3::class);
|
||||
})->covers(CoversClass3::class, 'testCoversFunction');
|
||||
|
||||
it('uses the correct PHPUnit attribute for trait', function () {
|
||||
$attributes = (new ReflectionClass($this))->getAttributes();
|
||||
|
||||
expect($attributes[4]->getName())->toBe('PHPUnit\Framework\Attributes\CoversClass');
|
||||
expect($attributes[4]->getArguments()[0])->toBe('Tests\Fixtures\Covers\CoversTrait');
|
||||
})->coversClass(CoversTrait::class);
|
||||
|
||||
it('appends CoversNothing to method attributes', function () {
|
||||
$phpDoc = (new ReflectionClass($this))->getMethod($this->name());
|
||||
|
||||
|
||||
8
tests/Fixtures/Covers/CoversTrait.php
Normal file
8
tests/Fixtures/Covers/CoversTrait.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fixtures\Covers;
|
||||
|
||||
trait CoversTrait
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user