getMock('\Goodby\CSV\Import\Protocol\InterpreterInterface'); $interpreter->expects($this->once()) ->method('interpret') ->with($this->identicalTo($line)) ; $interpreter->interpret($line); } /** * @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"; $interpreter->interpret($line); } }