예제 #1
0
<?php

$I = new TestGuy\UserSteps($scenario);
$I->wantTo('start a discussion');
$I->amAdmin();
$I->haveCategory(['name' => 'Testing', 'slug' => 'test']);
$I->amOnPage('/');
$I->see('Start a Discussion');
$I->click('Discussions');
$I->click('Start a Discussion');
$I->see('Start a Discussion', 'h1');
$I->seeRecord('Phosphorum\\Models\\Categories', ['name' => 'Testing']);
$I->fillField('#title', 'How can I write tests in Codeception');
$I->fillField('#content', 'Is there any manual');
$I->selectOption('#categoryId', 'Testing');
$I->click('Submit Discussion');
$I->see('How can I write tests in Codeception', 'h1');
$I->seeInCurrentUrl('/how-can-i-write-tests-in-codeception');
예제 #2
0
<?php

$I = new TestGuy\UserSteps($scenario);
$I->wantTo('reply in a discussion');
$user_id = $I->amAdmin();
$cat_id = $I->haveCategory(array('name' => 'Testing', 'slug' => 'test'));
$post_id = $I->havePost(array('title' => 'Please help with testing', 'content' => 'How can I install Codeception', 'users_id' => $user_id, 'slug' => 'please-help-with-testing', 'categories_id' => $cat_id));
$I->amOnPage("/discussions");
$I->seeLink('Please help with testing');
$I->click('Please help with testing');
$I->see('Please help with testing', 'h1');
$I->fillField('#content', 'I can do that!');
$I->click('Add Comment');
$I->see('I can do that!', '.post-content');