-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathInterpreterTest.php
More file actions
44 lines (34 loc) · 1.16 KB
/
InterpreterTest.php
File metadata and controls
44 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Goodby\CSV\Import\Tests\Protocol;
use Goodby\CSV\Import\Protocol\Exception\InvalidLexicalException;
/**
* unit test for Interface of the Interpreter
*/
class InterpreterTest extends \PHPUnit_Framework_TestCase
{
public function testInterpreterInterface()
{
$line = array();
$url = 'filepath';
$interpreter = $this->getMock('\Goodby\CSV\Import\Protocol\InterpreterInterface');
$interpreter->expects($this->once())
->method('interpret')
->with($this->identicalTo($line))
;
$interpreter->interpret($line, $url);
}
/**
* @expectedException \Goodby\CSV\Import\Protocol\Exception\InvalidLexicalException
*/
public function testInterpreterInterfaceWillThrownInvalidLexicalException()
{
$interpreter = $this->getMock('\Goodby\CSV\Import\Protocol\InterpreterInterface');
$interpreter->expects($this->once())
->method('interpret')
->will($this->throwException(new InvalidLexicalException()))
;
$line = "INVALID LEXICAL";
$url = 'filepath';
$interpreter->interpret($line, $url);
}
}