mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
cleanup and tests
This commit is contained in:
parent
ae39548ddb
commit
05f48fd0a0
7 changed files with 110 additions and 25 deletions
|
|
@ -7,7 +7,7 @@ use Demostf\API\Demo\RawParser;
|
|||
use Demostf\API\Test\TestCase;
|
||||
|
||||
class ParserTest extends TestCase {
|
||||
/** @var RawParser */
|
||||
/** @var RawParser|\PHPUnit_Framework_MockObject_MockObject */
|
||||
private $rawParser;
|
||||
|
||||
public function setUp() {
|
||||
|
|
@ -34,4 +34,22 @@ class ParserTest extends TestCase {
|
|||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFailedParse() {
|
||||
/** @var RawParser|\PHPUnit_Framework_MockObject_MockObject $rawParser */
|
||||
$rawParser = $this->getMockBuilder(RawParser::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$parser = new Parser($rawParser);
|
||||
|
||||
$rawParser->expects($this->any())
|
||||
->method('parse')
|
||||
->willReturn(null);
|
||||
|
||||
$parser->analyse('foo');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue