예제 #1
0
<?php

/**
 * @var \Codeception\Scenario $scenario
 */
$I = new Step\Functional\UserSteps($scenario);
$I->wantTo('reply in a discussion');
$userId = $I->amRegularUser();
$catId = $I->haveCategory(['name' => 'Testing', 'slug' => 'test', 'description' => 'codeception functional test']);
$postId = $I->havePost(['title' => 'Please help with testing', 'content' => 'How can I install Codeception', 'users_id' => $userId, 'slug' => 'please-help-with-testing', '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');
예제 #2
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\Functional\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');
예제 #3
0
<?php

/**
 * Test for https://github.com/phalcon/forum/issues/85 issue
 *
 * @var \Codeception\Scenario $scenario
 */
$I = new Step\Functional\UserSteps($scenario);
$I->wantTo('use underscored character in content and see correct url');
$userId = $I->amRegularUser();
$catId = $I->haveCategory(['name' => 'Installation', 'slug' => 'installation', 'description' => 'Installation related posts']);
$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 - Phalcon Framework');
$I->seeLink('Is there a precompiled binary for 64 bit Centos out there');
$I->click('Is there a precompiled binary for 64 bit Centos out there');
$I->seeInCurrentUrl(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/');
예제 #4
0
<?php

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

/**
 * @var Codeception\Scenario $scenario
 */
$I = new Step\Functional\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');
예제 #6
0
<?php

/**
 * @issue 87
 * @var   Codeception\Scenario $scenario
 */
$I = new Step\Functional\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 - Phalcon Framework');
$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));