[PHP] PHP删除 Setting 方法 →→→→→进入此内容的聊天室

来自 , 2019-09-20, 写在 PHP, 查看 105 次.
URL http://www.code666.cn/view/c57abe86
  1. <?php
  2. class RemoveSettingMethod extends PHPUnit_Framework_TestCase
  3. {
  4.     public function testAQuestionIsDisplayedTogetherWithTheNumberOfResponses()
  5.     {
  6.         $question = new Question('How do I install PHP on the washing machine?', 10);
  7.         $this->assertEquals('How do I install PHP on the washing machine? (responses: 10)', $question->__toString());
  8.     }
  9. }
  10.  
  11. class Question
  12. {
  13.     private $text;
  14.     private $responses;
  15.  
  16.     public function __construct($text, $responses = 0)
  17.     {
  18.         $this->setText($text);
  19.         $this->responses = $responses;
  20.     }
  21.  
  22.     public function setText($text)
  23.     {
  24.         $text = trim($text);
  25.         $this->text = $text;
  26.     }
  27.  
  28.     public function __toString()
  29.     {
  30.         return $this->text . ' (responses: ' . $this->responses . ')';
  31.     }
  32. }

回复 "PHP删除 Setting 方法"

这儿你可以回复上面这条便签

captcha