$I->am('An Admin');
$I->amGoingTo('Try to view a Blog Post that is marked as draft');
$I->loginAsAdmin();
$I->amOnPage('/blog/example-unpublished-post');
$I->canSeeResponseCodeIs(200);
KHông có quyền truy cập
$I->am('A random website visitor');
$I->amGoingTo('Try to view a Blog Post that is marked as draft');
$I->amOnPage('/blog/example-unpublished-post');
$I->canSeePageNotFound();
Url không đúng
$I->am('A random website visitor');
$I->amGoingTo('Navigate to a blog post that doesnt exists');
$I->amOnPage('/blog/random-slug');
$I->canSeeResponseCodeIs(404);
To execute FooCest.php found in the directory path tests/unit/Model
vendor/bin/codecept --steps --debug --verbose run unit Model/FooCest.php
To execute all the tests labeled with the group current
vendor/bin/codecept --steps --debug --verbose run -g current
Lệnh chạy thử controller trong dự án
vendor/bin/codecept --steps --debug --verbose run unit tests/codeception/functional/controllers/BlogPostControllerCest.php
Ứng dụng luôn vào project hiện tại của mình?
php composer.phar require "codeception/codeception:*"
)vendor/bin/codecept bootstrap
vendor/bin/codecept build
vendor/bin/codecept --steps --debug --verbose run unit Model/FooCest.php
vendor/bin/codecept --steps --debug --verbose run -g current
vendor/bin/codecept --steps --debug --verbose run unit tests/codeception/functional/controllers/BlogPostControllerCest.php