PHPUnit如何通过注解生成测试类
天蓬老师
天蓬老师 2017-04-10 16:26:16
0
1
476

我在《PHP核心技术与最佳实践》(列旭松 陈文 著)中的第12章节中了解到PHPUnit可以通过注解生成测试类:

class Calculator
{
    /**
     * @assert (0, 0) == 0
     * @assert (0, 1) == 1
     * @assert (1, 0) == 1
     * @assert (1, 1) == 2
     * @assert (1, 1) == 3
     */
    public function add($a, $b){
        return $a + $b;
    }

    public function add2($a, $b){
        return $a + $b;
    }

}

以上代码会生成五个assert断言,但是书中是使用NetBean,我手头条件限制无法复现,请问如何通过命令完成以上需求?(PHPUnit stable v5.0)

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!