/** * @expectedException DomainException */ public function testCommitMethodThrowDomainException() { // Mock actions $this->connection->shouldReceive('createErrors')->once()->andReturn($this->errors); $this->connection->shouldReceive('commit')->once()->andReturn($this->response); $this->request->shouldReceive('setResponse')->once()->andReturn($this->request); // Test start here $transaction = new Response($this->connection, $this->request, $this->responseArray); $response = $transaction->commit(); $this->assertInstanceOf('EndyJasmi\\Neo4j\\ResponseInterface', $response); }