Esempio n. 1
0
 public function testRemoveErrorInfosByParamsAllErrorsRemoved()
 {
     $message = "message";
     $message2 = "message2";
     $this->errorInfos->expects($this->at(0))->method('addItem')->with(null, null, $message);
     $this->errorInfos->expects($this->at(1))->method('addItem')->with(null, null, $message2);
     $this->assertEquals($this->model, $this->model->addErrorInfo(null, null, $message));
     $this->assertEquals($this->model, $this->model->addErrorInfo(null, null, $message2));
     $this->assertEquals($message . "\n" . $message2, $this->model->getMessage());
     $params = [];
     $removedItems = [['message' => $message], ['message' => $message2]];
     $this->errorInfos->expects($this->once())->method('removeItemsByParams')->with($params)->will($this->returnValue($removedItems));
     $this->errorInfos->expects($this->once())->method('getItems')->will($this->returnValue([]));
     $this->assertEquals($this->model, $this->model->removeErrorInfosByParams($params));
     $this->assertFalse($this->model->getHasError());
     $this->assertEquals('', $this->model->getMessage());
 }