16:12 2015/12/8
PHPUnit test success, code written in the WWW directory, named after the class name code file, my file name is
Arraytest.php, the class named Arraytest, internally writes a simple test code:
<?php
Require_once ' phpunit/autoload.php ';
Require_once ' ArrayTeller.class.php ';
Require_once ' phpunit/framework.php ';
Class Arraytest extends Phpunit_framework_testcase
{
Public Function Testnewarrayisempty ()
{
Creates an array of fixture.
$fixture = Array ();
Asserts that the size of the array fixture is 0.
$this->assertequals (0, sizeof ($fixture));
}
/**
* Test method for defining the method that the test tag declares
* @test
*/
Public Function Indexequals ()
{
Creates an array of fixture.
$stack = Array (1, 2, 3);
Asserts that the size of the array fixture is 0.
$this->assertequals (2, $stack [1]);
}
}
And then
CMD dos window into the WWW directory,
Execute PHPUnit arraytest.php, enter to execute
Finally succeeded.
PHPUnit Test successful PHPUnit test practice code