mirror of
https://github.com/danog/psalm-plugin-phpunit.git
synced 2024-12-12 01:19:44 +01:00
6e0f0643d6
- Added Codeception scaffolding - Added travis config - Added example test
29 lines
696 B
Gherkin
29 lines
696 B
Gherkin
Feature: Assert
|
|
In order to use PHPUnit safely
|
|
As a Psalm user
|
|
I need Psalm to typecheck asserts
|
|
|
|
Background:
|
|
Given I have the following code preamble
|
|
"""
|
|
<?php
|
|
namespace NS;
|
|
use PHPUnit\Framework\Assert;
|
|
|
|
"""
|
|
|
|
Scenario: Asserting instanceof
|
|
Given I have the following code
|
|
"""
|
|
function f(): \Exception {
|
|
return rand(0,1) ? new \RuntimeException : new \InvalidArgumentException;
|
|
}
|
|
function acceptsRuntimeException(\RuntimeException $_e): void {}
|
|
|
|
$e = f();
|
|
Assert::assertInstanceOf(\RuntimeException::class, $e);
|
|
acceptsRuntimeException($e);
|
|
"""
|
|
When I run Psalm
|
|
Then I see no errors
|