Example #1
0
<?php

/**
 * @issue 85
 * @var   Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('use underscored character in content and see correct url');
$userId = $I->amRegularUser();
$catId = $I->haveCategory();
$postId = $I->havePost(['title' => 'Is there a precompiled binary for 64 bit Centos out there', 'content' => '[this reddit topic](http://www.reddit.com/r/PHP/comments/2s7bbr/phalconphp_vs_php_disappointing_results/)', 'users_id' => $userId, 'slug' => 'is-there-a-precompiled-binary-for-64-bit-centos-out-there', 'categories_id' => $catId]);
$I->amOnPage('/discussions');
$I->seeInTitle('Discussions - ');
$I->seeLink('Is there a precompiled binary for 64 bit Centos out there', sprintf('/discussion/%s/is-there-a-precompiled-binary-for-64-bit-centos-out-there', $postId));
$I->amOnPage(sprintf('/discussion/%s/is-there-a-precompiled-binary-for-64-bit-centos-out-there', $postId));
$I->seeLink('this reddit topic', 'http://www.reddit.com/r/PHP/comments/2s7bbr/phalconphp%5vs%5php%5disappointing%5results/');
Example #2
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 #3
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('go to the not found page and see flash banner');
$I->amOnPage('/abcdef-jaja');
$I->see('Unfortunately, the page you are requesting can not be found!');
Example #4
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\UserSteps($scenario);
$I->wantTo('see banner with info about too many negative votes');
$postId = $I->havePost(['title' => 'Negative reputation', 'content' => 'This may be a little bit of a noob question but here goes.', 'users_id' => 1, 'categories_id' => 1, 'votes_up' => 0, 'votes_down' => 5]);
$I->amOnPage("/discussion/{$postId}/negative-reputation");
$I->see('Too many negative votes', '//body/div/div[1]/div[2]/h4');
$I->see('This post has too many negative votes. The cause of this could be:', '//body/div/div[1]/div[2]/p');
$I->see('Irrelevant or controversial information', '//body/div/div[1]/div[2]/ul/li[1]');
$I->see('Confusing question or not a real question', '//body/div/div[1]/div[2]/ul/li[2]');
$I->see('Aggressive vocabulary, excessive rudeness, etc', '//body/div/div[1]/div[2]/ul/li[3]');
Example #5
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 #6
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 #7
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 #8
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');