jjzjj

RecordLookup

全部标签

php - mock 对象参数验证问题

考虑示例类(很抱歉它太复杂了,但它尽可能简洁):classRecordLookup{private$records=[13=>'foo',42=>'bar',];function__construct($id){$this->record=$this->records[$id];}publicfunctiongetRecord(){return$this->record;}}classRecordPage{publicfunctionrun(RecordLookup$id){return"Recordis".$id->getRecord();}}classApp{function__c