教你一步一步写一个phpunit testcase(5)
发表于:2017-06-01来源:叶左左作者:叶左左点击数:
标签:PHPUnit
@param $id * @param $name * @param $startDate * @param $endDate * @param $attendLimit */ public function __construct ($id, $name, $startDate, $endDate, $attendLimit) { $this -id = $id; $this -name = $
@param $id
*
@param $name
*
@param $startDate
*
@param $endDate
*
@param $attendLimit
*/
public function __construct($id, $name, $startDate, $endDate, $attendLimit) {
$this->id = $id;
$this->name = $name;
$this->startDate = $startDate;
$this->endDate = $endDate;
$this->attendLimit = $attendLimit;
}
public function reserve($user) {
if (
$this->attendLimit >
$this->getAttendNumber()) {
if (array_key_exists($user->id,
$this->attendArr)) {
throw new EventException(
'Duplicated reservation', EventException::DUPLICATED_RESERVATION);
}
$this->attendArr[$user->id] = $user;
return true;
}
return false;
}
public function
原文转自:http://www.jianshu.com/p/ba6829a6f3ec