Example #1
0
<?php

/**
 * @issue 87
 * @var   Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('use illegal characters in title and get correct slug');
$userId = $I->amRegularUser();
$catId = $I->haveCategory();
$postId = $I->havePost(['title' => 'model->save() return TRUE when no matching database column', 'users_id' => $userId, 'categories_id' => $catId, 'slug' => false]);
$I->amOnPage('/');
$I->seeInTitle('Discussions - ');
$I->seeLink('model->save() return TRUE when no matching database column');
$I->click('model->save() return TRUE when no matching database column');
$I->seeInCurrentUrl(sprintf('/discussion/%s/modelsave-return-true-when-no-matching-database-column', $postId));
Example #2
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('reply in a discussion');
$userId = $I->amRegularUser();
$catId = $I->haveCategory();
$postId = $I->havePost(['title' => 'Please help with testing', 'users_id' => $userId, 'categories_id' => $catId]);
$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');
Example #3
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('start a discussion');
$I->amRegularUser();
$I->haveCategory(['name' => 'Testing']);
$I->amOnPage('/');
$I->see('Start a Discussion');
$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');
Example #4
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('see latest post on front page at top of table');
$userId = $I->amRegularUser();
$catId = $I->haveCategory();
$postId = $I->havePost(['title' => 'Binding Parameters', 'content' => 'This may be a little bit of a noob question but here goes.', 'users_id' => $userId, 'categories_id' => $catId]);
$I->amOnPage('/');
$I->seeInTitle('Discussions - ');
$I->seeElement('.post-positive td');
$I->see('Binding Parameters', '.post-positive td');
$I->click('Binding Parameters');
$I->see('Binding Parameters', 'h1');
Example #5
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('use the mention name as a link');
$userId = $I->amRegularUser();
$catId = $I->haveCategory();
$postId = $I->havePost(['title' => 'Router Phalcon', 'content' => 'I have a question I could not find anywhere, and I ask @123456789, ' . '@12er45t and @iregular help. Let me test: @%, @&abcd and xxx@xxx', 'users_id' => $userId, 'categories_id' => $catId]);
$I->amOnPage('/discussions');
$I->click('Router Phalcon');
$I->see('I have a question I could not find anywhere, and I ask @123456789, @12er45t and @iregular help.', '.post-content');
$I->seeLink('@123456789', '/user/0/123456789');
$I->seeLink('@12er45t', '/user/0/12er45t');
$I->seeLink('@iregular', '/user/0/iregular');
$I->dontSeeLink('@%', '/user/0/%');
$I->dontSeeLink('@&abcd', '/user/0/&abcd');
$I->dontSeeLink('xxx@xxx', '/user/0/xxxxxx');
$I->dontSeeLink('@xxx', '/user/0/xxx');