mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47: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\CoversClass1;
|
||||||
use Tests\Fixtures\Covers\CoversClass2;
|
use Tests\Fixtures\Covers\CoversClass2;
|
||||||
use Tests\Fixtures\Covers\CoversClass3;
|
use Tests\Fixtures\Covers\CoversClass3;
|
||||||
|
use Tests\Fixtures\Covers\CoversTrait;
|
||||||
|
|
||||||
$runCounter = 0;
|
$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);
|
expect($attributes[3]->getArguments()[0])->toBe(CoversClass3::class);
|
||||||
})->covers(CoversClass3::class, 'testCoversFunction');
|
})->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 () {
|
it('appends CoversNothing to method attributes', function () {
|
||||||
$phpDoc = (new ReflectionClass($this))->getMethod($this->name());
|
$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