phpspec入门

入门

  1. 执行bin/phpspec desc Markdown生成MarkdownSpec类
  2. 执行bin/phpspec run提示生成Markdown类
  3. 在MarkdownSpec类添加方法
    function it_converts_plain_text_to_html_paragraphs()
    {
        $this->toHtml("Hi, there")->shouldReturn("
<p>
    Hi, there
</p>
");
    }
  1. 执行bin/phpspec run提示生成Markdown类的toHtml方法
  2. 编写Markdown类的toHtml方法
    public function toHtml($argument1)
    {
        return "
<p>
    Hi, there11
</p>
";//这里故意写错
    }
  1. 执行bin/phpspec run
Markdown                                                                        
  11  - it converts plain text to html paragraphs
      expected "
<p>
    Hi, there
</p>
", but got "
<p>
    Hi, there11
</p>
".

                                      100%                                       1
1 specs
1 example (1 failed)
192ms



Tagged . Bookmark the permalink.

Comments are closed.