Home > php教程 > php手册 > body text

PHPUnit初试

WBOY
Release: 2016-06-20 08:42:16
Original
1608 people have browsed it

先测试了一下加减,检查一下环境,又调用函数测试了服务器名。

源代码:

<span style="color: #008080;"> 1</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> DemoController extends \Think\Controller
</span><span style="color: #008080;"> 2</span> <span style="color: #000000;">{
</span><span style="color: #008080;"> 3</span> 
<span style="color: #008080;"> 4</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 5</span> <span style="color: #008000;">     * @assert (5, 8) == 13
</span><span style="color: #008080;"> 6</span> <span style="color: #008000;">     * @assert (16, 76) == 92
</span><span style="color: #008080;"> 7</span> <span style="color: #008000;">     * @assert (6, 16) == 32
</span><span style="color: #008080;"> 8</span> <span style="color: #008000;">     * @assert (6, 4) == 0
</span><span style="color: #008080;"> 9</span> <span style="color: #008000;">     * @assert ('abc', 1) == 2
</span><span style="color: #008080;">10</span> <span style="color: #008000;">     * @param int $a
</span><span style="color: #008080;">11</span> <span style="color: #008000;">     * @param int $b
</span><span style="color: #008080;">12</span> <span style="color: #008000;">     * @return int
</span><span style="color: #008080;">13</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">14</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function plus($a, $b)
</span><span style="color: #008080;">15</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">16</span>         <span style="color: #0000ff;">return</span> $a +<span style="color: #000000;"> $b;
</span><span style="color: #008080;">17</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">18</span> 
<span style="color: #008080;">19</span>      <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">20</span> <span style="color: #008000;">     * @assert (14, 8) == 6
</span><span style="color: #008080;">21</span> <span style="color: #008000;">     * @assert (16, 6) == 10
</span><span style="color: #008080;">22</span> <span style="color: #008000;">     * @assert (6, 4) == 0
</span><span style="color: #008080;">23</span> <span style="color: #008000;">     * @assert ('45', 1) == 44
</span><span style="color: #008080;">24</span> <span style="color: #008000;">     * @param int $a
</span><span style="color: #008080;">25</span> <span style="color: #008000;">     * @param int $b
</span><span style="color: #008080;">26</span> <span style="color: #008000;">     * @return int
</span><span style="color: #008080;">27</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">28</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function subtract($a, $b)
</span><span style="color: #008080;">29</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">30</span>         <span style="color: #0000ff;">return</span> $a -<span style="color: #000000;"> $b;
</span><span style="color: #008080;">31</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">32</span> 
<span style="color: #008080;">33</span>     <span style="color: #0000ff;">public</span> function connectToServer($serverName = <span style="color: #0000ff;">null</span><span style="color: #000000;">)
</span><span style="color: #008080;">34</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">35</span>         <span style="color: #0000ff;">if</span> ($serverName == <span style="color: #0000ff;">null</span><span style="color: #000000;">) {
</span><span style="color: #008080;">36</span>             <span style="color: #0000ff;">throw</span> <span style="color: #0000ff;">new</span> Exception(<span style="color: #800000;">"</span><span style="color: #800000;">这不是一个服务器名</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #008080;">37</span> <span style="color: #000000;">        }
</span><span style="color: #008080;">38</span>         $fp = fsockopen($serverName, <span style="color: #800080;">8080</span><span style="color: #000000;">);
</span><span style="color: #008080;">39</span>         <span style="color: #0000ff;">return</span> ($fp) ? <span style="color: #0000ff;">true</span> : <span style="color: #0000ff;">false</span><span style="color: #000000;">;
</span><span style="color: #008080;">40</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">41</span> 
<span style="color: #008080;">42</span> 
<span style="color: #008080;">43</span> }
Copy after login

生成测试文件:

<span style="color: #008080;">  1</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> DemoControllerTest extends \PHPUnit_Framework_TestCase
</span><span style="color: #008080;">  2</span> <span style="color: #000000;">{
</span><span style="color: #008080;">  3</span> 
<span style="color: #008080;">  4</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">  5</span> <span style="color: #008000;">     * @var DemoController
</span><span style="color: #008080;">  6</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">  7</span>     <span style="color: #0000ff;">protected</span> $<span style="color: #0000ff;">object</span><span style="color: #000000;">;
</span><span style="color: #008080;">  8</span> 
<span style="color: #008080;">  9</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 10</span> <span style="color: #008000;">     * Sets up the fixture, for example, opens a network connection.
</span><span style="color: #008080;"> 11</span> <span style="color: #008000;">     * This method is called before a test is executed.
</span><span style="color: #008080;"> 12</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 13</span>     <span style="color: #0000ff;">protected</span><span style="color: #000000;"> function setUp()
</span><span style="color: #008080;"> 14</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 15</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span> = <span style="color: #0000ff;">new</span><span style="color: #000000;"> DemoController;
</span><span style="color: #008080;"> 16</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 17</span> 
<span style="color: #008080;"> 18</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 19</span> <span style="color: #008000;">     * Tears down the fixture, for example, closes a network connection.
</span><span style="color: #008080;"> 20</span> <span style="color: #008000;">     * This method is called after a test is executed.
</span><span style="color: #008080;"> 21</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 22</span>     <span style="color: #0000ff;">protected</span><span style="color: #000000;"> function tearDown()
</span><span style="color: #008080;"> 23</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 24</span>         
<span style="color: #008080;"> 25</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 26</span> 
<span style="color: #008080;"> 27</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 28</span> <span style="color: #008000;">     * Generated from @assert (5, 8) == 13.
</span><span style="color: #008080;"> 29</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 30</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::plus
</span><span style="color: #008080;"> 31</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 32</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testPlus()
</span><span style="color: #008080;"> 33</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 34</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 35</span>                 <span style="color: #800080;">13</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->plus(<span style="color: #800080;">5</span>, <span style="color: #800080;">8</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 36</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 37</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 38</span> 
<span style="color: #008080;"> 39</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 40</span> <span style="color: #008000;">     * Generated from @assert (16, 76) == 92.
</span><span style="color: #008080;"> 41</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 42</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::plus
</span><span style="color: #008080;"> 43</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 44</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testPlus2()
</span><span style="color: #008080;"> 45</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 46</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 47</span>                 <span style="color: #800080;">92</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->plus(<span style="color: #800080;">16</span>, <span style="color: #800080;">76</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 48</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 49</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 50</span> 
<span style="color: #008080;"> 51</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 52</span> <span style="color: #008000;">     * Generated from @assert (6, 16) == 32.
</span><span style="color: #008080;"> 53</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 54</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::plus
</span><span style="color: #008080;"> 55</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 56</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testPlus3()
</span><span style="color: #008080;"> 57</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 58</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 59</span>                 <span style="color: #800080;">32</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->plus(<span style="color: #800080;">6</span>, <span style="color: #800080;">16</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 60</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 61</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 62</span> 
<span style="color: #008080;"> 63</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 64</span> <span style="color: #008000;">     * Generated from @assert (6, 4) == 0.
</span><span style="color: #008080;"> 65</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 66</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::plus
</span><span style="color: #008080;"> 67</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 68</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testPlus4()
</span><span style="color: #008080;"> 69</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 70</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 71</span>                 <span style="color: #800080;">0</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->plus(<span style="color: #800080;">6</span>, <span style="color: #800080;">4</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 72</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 73</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 74</span> 
<span style="color: #008080;"> 75</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 76</span> <span style="color: #008000;">     * Generated from @assert ('abc', 1) == 0.
</span><span style="color: #008080;"> 77</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 78</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::plus
</span><span style="color: #008080;"> 79</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 80</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testPlus5()
</span><span style="color: #008080;"> 81</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 82</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 83</span>                 <span style="color: #800080;">2</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->plus(<span style="color: #800000;">'</span><span style="color: #800000;">abc</span><span style="color: #800000;">'</span>, <span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 84</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 85</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 86</span> 
<span style="color: #008080;"> 87</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 88</span> <span style="color: #008000;">     * Generated from @assert (14, 8) == 6.
</span><span style="color: #008080;"> 89</span> <span style="color: #008000;">     *
</span><span style="color: #008080;"> 90</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::subtract
</span><span style="color: #008080;"> 91</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;"> 92</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testSubtract()
</span><span style="color: #008080;"> 93</span> <span style="color: #000000;">    {
</span><span style="color: #008080;"> 94</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;"> 95</span>                 <span style="color: #800080;">6</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->subtract(<span style="color: #800080;">14</span>, <span style="color: #800080;">8</span><span style="color: #000000;">)
</span><span style="color: #008080;"> 96</span> <span style="color: #000000;">        );
</span><span style="color: #008080;"> 97</span> <span style="color: #000000;">    }
</span><span style="color: #008080;"> 98</span> 
<span style="color: #008080;"> 99</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">100</span> <span style="color: #008000;">     * Generated from @assert (16, 6) == 10.
</span><span style="color: #008080;">101</span> <span style="color: #008000;">     *
</span><span style="color: #008080;">102</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::subtract
</span><span style="color: #008080;">103</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">104</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testSubtract2()
</span><span style="color: #008080;">105</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">106</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;">107</span>                 <span style="color: #800080;">10</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->subtract(<span style="color: #800080;">16</span>, <span style="color: #800080;">6</span><span style="color: #000000;">)
</span><span style="color: #008080;">108</span> <span style="color: #000000;">        );
</span><span style="color: #008080;">109</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">110</span> 
<span style="color: #008080;">111</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">112</span> <span style="color: #008000;">     * Generated from @assert (6, 4) == 0.
</span><span style="color: #008080;">113</span> <span style="color: #008000;">     *
</span><span style="color: #008080;">114</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::subtract
</span><span style="color: #008080;">115</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">116</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testSubtract3()
</span><span style="color: #008080;">117</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">118</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;">119</span>                 <span style="color: #800080;">0</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->subtract(<span style="color: #800080;">6</span>, <span style="color: #800080;">4</span><span style="color: #000000;">)
</span><span style="color: #008080;">120</span> <span style="color: #000000;">        );
</span><span style="color: #008080;">121</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">122</span> 
<span style="color: #008080;">123</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">124</span> <span style="color: #008000;">     * Generated from @assert ('abc', 1) == 0.
</span><span style="color: #008080;">125</span> <span style="color: #008000;">     *
</span><span style="color: #008080;">126</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::subtract
</span><span style="color: #008080;">127</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">128</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testSubtract4()
</span><span style="color: #008080;">129</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">130</span>         $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">assertEquals(
</span><span style="color: #008080;">131</span>                 <span style="color: #800080;">44</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->subtract(<span style="color: #800000;">'</span><span style="color: #800000;">45</span><span style="color: #800000;">'</span>, <span style="color: #800080;">1</span><span style="color: #000000;">)
</span><span style="color: #008080;">132</span> <span style="color: #000000;">        );
</span><span style="color: #008080;">133</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">134</span> 
<span style="color: #008080;">135</span>     <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;">136</span> <span style="color: #008000;">     * @covers Home\Controller\DemoController::connectToServer
</span><span style="color: #008080;">137</span> <span style="color: #008000;">     * @todo   Implement testConnectToServer().
</span><span style="color: #008080;">138</span>      <span style="color: #008000;">*/</span>
<span style="color: #008080;">139</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testConnectToServer()
</span><span style="color: #008080;">140</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">141</span> <span style="color: #008000;">//</span>        <span style="color: #008000;">//</span><span style="color: #008000;"> Remove the following lines when you implement this test.
</span><span style="color: #008080;">142</span> <span style="color: #008000;">//</span><span style="color: #008000;">        $this->markTestIncomplete(
</span><span style="color: #008080;">143</span> <span style="color: #008000;">//</span><span style="color: #008000;">                'This test has not been implemented yet.'
</span><span style="color: #008080;">144</span> <span style="color: #008000;">//</span><span style="color: #008000;">        );</span>
<span style="color: #008080;">145</span>         $serverName = <span style="color: #800000;">'</span><span style="color: #800000;">wwwcom</span><span style="color: #800000;">'</span><span style="color: #000000;">;
</span><span style="color: #008080;">146</span>         $<span style="color: #0000ff;">this</span>->assertTrue($<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->connectToServer($serverName) === <span style="color: #0000ff;">false</span><span style="color: #000000;">);
</span><span style="color: #008080;">147</span> <span style="color: #000000;">    }
</span><span style="color: #008080;">148</span>     <span style="color: #0000ff;">public</span><span style="color: #000000;"> function testConnectToServer2()
</span><span style="color: #008080;">149</span> <span style="color: #000000;">    {
</span><span style="color: #008080;">150</span>         $serverName = <span style="color: #800000;">'</span><span style="color: #800000;">www.baidu.com</span><span style="color: #800000;">'</span><span style="color: #000000;">;
</span><span style="color: #008080;">151</span>         $<span style="color: #0000ff;">this</span>->assertTrue($<span style="color: #0000ff;">this</span>-><span style="color: #0000ff;">object</span>->connectToServer($serverName) !== <span style="color: #0000ff;">false</span><span style="color: #000000;">);
</span><span style="color: #008080;">152</span>     }
Copy after login

这里的服务器测试用例是手动加上去的!

执行结果:

<span style="color: #008080;"> 1</span> ..FFF..F..F                                                       <span style="color: #800080;">11</span> / <span style="color: #800080;">11</span> (<span style="color: #800080;">100</span>%<span style="color: #000000;">)
</span><span style="color: #008080;"> 2</span> 
<span style="color: #008080;"> 3</span> Time: <span style="color: #800080;">44.42</span> seconds, Memory: <span style="color: #800080;">8</span><span style="color: #000000;">.75Mb
</span><span style="color: #008080;"> 4</span> 
<span style="color: #008080;"> 5</span> There were <span style="color: #800080;">5</span><span style="color: #000000;"> failures:
</span><span style="color: #008080;"> 6</span> 
<span style="color: #008080;"> 7</span> <span style="color: #800080;">1</span><span style="color: #000000;">) Home\Controller\DemoControllerTest::testPlus3
</span><span style="color: #008080;"> 8</span> Failed asserting that <span style="color: #800080;">22</span> matches expected <span style="color: #800080;">32</span><span style="color: #000000;">.
</span><span style="color: #008080;"> 9</span> 
<span style="color: #008080;">10</span> D:\wamp\www\wxportal\tests\Application\Home\Controller\DemoController.classTest.php:<span style="color: #800080;">67</span>
<span style="color: #008080;">11</span> 
<span style="color: #008080;">12</span> <span style="color: #800080;">2</span><span style="color: #000000;">) Home\Controller\DemoControllerTest::testPlus4
</span><span style="color: #008080;">13</span> Failed asserting that <span style="color: #800080;">10</span> matches expected <span style="color: #800080;">0</span><span style="color: #000000;">.
</span><span style="color: #008080;">14</span> 
<span style="color: #008080;">15</span> D:\wamp\www\wxportal\tests\Application\Home\Controller\DemoController.classTest.php:<span style="color: #800080;">79</span>
<span style="color: #008080;">16</span> 
<span style="color: #008080;">17</span> <span style="color: #800080;">3</span><span style="color: #000000;">) Home\Controller\DemoControllerTest::testPlus5
</span><span style="color: #008080;">18</span> Failed asserting that <span style="color: #800080;">1</span> matches expected <span style="color: #800080;">2</span><span style="color: #000000;">.
</span><span style="color: #008080;">19</span> 
<span style="color: #008080;">20</span> D:\wamp\www\wxportal\tests\Application\Home\Controller\DemoController.classTest.php:<span style="color: #800080;">91</span>
<span style="color: #008080;">21</span> 
<span style="color: #008080;">22</span> <span style="color: #800080;">4</span><span style="color: #000000;">) Home\Controller\DemoControllerTest::testSubtract3
</span><span style="color: #008080;">23</span> Failed asserting that <span style="color: #800080;">2</span> matches expected <span style="color: #800080;">0</span><span style="color: #000000;">.
</span><span style="color: #008080;">24</span> 
<span style="color: #008080;">25</span> D:\wamp\www\wxportal\tests\Application\Home\Controller\DemoController.classTest.php:<span style="color: #800080;">127</span>
<span style="color: #008080;">26</span> 
<span style="color: #008080;">27</span> <span style="color: #800080;">5</span><span style="color: #000000;">) Home\Controller\DemoControllerTest::testConnectToServer2
</span><span style="color: #008080;">28</span> Failed asserting that <span style="color: #0000ff;">false</span> <span style="color: #0000ff;">is</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">.
</span><span style="color: #008080;">29</span> 
<span style="color: #008080;">30</span> D:\wamp\www\wxportal\tests\Application\Home\Controller\DemoController.classTest.php:<span style="color: #800080;">158</span>
<span style="color: #008080;">31</span> 
<span style="color: #008080;">32</span> FAILURES!
<span style="color: #008080;">33</span> Tests: <span style="color: #800080;">11</span>, Assertions: <span style="color: #800080;">11</span>, Failures: <span style="color: #800080;">5</span><span style="color: #000000;">.
</span><span style="color: #008080;">34</span> 完成。
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template