mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
RectorDefinitionTest: cover guard method
This commit is contained in:
parent
8a185e93ec
commit
4171ca8317
@ -3,8 +3,11 @@
|
||||
namespace Rector\Tests\RectorDefinition;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Rector\Exception\RectorDefinition\CodeSamplesMissingException;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use stdClass;
|
||||
use TypeError;
|
||||
|
||||
final class RectorDefinitionTest extends TestCase
|
||||
{
|
||||
@ -23,4 +26,16 @@ final class RectorDefinitionTest extends TestCase
|
||||
$this->assertSame('Code before', $codeSample->getCodeBefore());
|
||||
$this->assertSame('Code after', $codeSample->getCodeAfter());
|
||||
}
|
||||
|
||||
public function testInvalidCodeSamplesType(): void
|
||||
{
|
||||
$this->expectException(TypeError::class);
|
||||
new RectorDefinition('Some description', [new stdClass()]);
|
||||
}
|
||||
|
||||
public function testInvalidCodeSamplesCount(): void
|
||||
{
|
||||
$this->expectException(CodeSamplesMissingException::class);
|
||||
new RectorDefinition('Some description', []);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user