PHP 测试框架 Codeception
fmms
12年前
Codeception 是一个全堆栈的 PHP 测试框架。Codeception is a new full-stack testing PHP framework. Inspired by BDD, it provides you absolutely new original way for writing acceptance, functional and even unit tests。
<?php class UserControllerCest { public $class = 'UserController'; public function createAction(CodeGuy $I) { $I->haveFakeClass($userController = Stub::make('UserController')); $I->executeTestedMethodOn($userController, array('username' => 'MilesDavis', 'email' => 'miles@davis.com')) ->seeResultEquals(true) ->seeMethodInvoked($userController, 'renderHtml') ->seeInDabatase('users', array('username' => 'MilesDavis')); } } ?>