public function deleteADiscussion(FunctionalTester $I, UserSteps $userSteps) { $userId = $userSteps->amRegularUser(); $catId = $userSteps->haveCategory(); $postId = $userSteps->havePost(['title' => 'Is there a way to validate only some fields?', 'users_id' => $userId, 'categories_id' => $catId]); $I->amOnPage("/discussion/{$postId}/abc"); $I->seeInTitle('Is there a way to validate only some fields? - Discussion'); $I->seeElement(['css' => 'a.btn-delete-post']); $I->click(['css' => 'a.btn-delete-post']); $I->see('Discussion was successfully deleted', '//body/div[1]/div/div/div'); }
public function deleteADiscussion(FunctionalTester $I, UserSteps $userSteps) { $userId = $userSteps->amRegularUser(); $catId = $userSteps->haveCategory(['name' => 'Some Category', 'slug' => 'some-category', 'description' => 'A description of the category']); $postId = $userSteps->havePost(['title' => 'Is there a way to validate only some fields?', 'content' => 'as I see, only the form itself can be validated. It validates if all fields passes, right?' . ' Well, this time I have to validate 3 fields - but those fields what passes, should go inside database.' . ' With the original schema, I cant do that', 'users_id' => $userId, 'slug' => 'is-there-a-way-to-validate-only-some-fields', 'categories_id' => $catId]); $I->amOnPage("/discussion/{$postId}/is-there-a-way-to-validate-only-some-fields"); $I->seeInTitle('Is there a way to validate only some fields? - Discussion - Phalcon Framework'); $I->seeElement(['css' => 'a.btn-delete-post']); $I->click(['css' => 'a.btn-delete-post']); $I->see('Discussion was successfully deleted', '//body/div[1]/div/div/div'); }
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('perform shadow login as first user'); $I->haveInSession('identity', 1); $I->haveInSession('identity-name', 'Phalcon'); $I->amOnPage('/'); $I->seeInTitle('Discussions - Phalcon Framework'); $I->see('Start a Discussion');
<?php $I = new FunctionalTester($scenario); $I->wantTo('create a category'); $I->am('knowledge admin'); $I->amOnPage('/categories/create'); $I->seeInTitle('Create category'); // form empty $I->amGoingTo('test validation'); $I->click('Create'); $I->dontSeeRecord('categories', []); $I->seeCurrentUrlEquals('/categories/create'); $I->see('The name field is required'); $I->see('The slug field is required'); // only empty name $I->amGoingTo('test name validation'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->dontSeeRecord('categories', ['slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories/create'); $I->see('The name field is required', '.error'); $I->seeInField('slug', 'libro'); $I->dontSee('The slug field is required'); // all form filled $I->fillField('name', 'Libro'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->haveRecord('categories', ['name' => 'Libro', 'slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories');
<?php /** * @var Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('perform shadow login as first user'); $I->haveInSession('identity', 1); $I->haveInSession('identity-name', 'Phalcon'); $I->amOnPage('/'); $I->seeInTitle('Discussions - '); $I->see('Start a Discussion');
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('open index page of site'); $I->amOnPage('/'); $I->seeInTitle('Phalcon Demo Application | Welcome'); $I->see("This is a Phalcon Demo Application. Please don't provide us any personal information. Thanks!"); $I->see('Log In/Sign Up'); $I->see('Phalcon Demo Application', 'h1');
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('perform shadow login as first user'); $I->haveInSession('identity', 1); $I->haveInSession('identity-name', 'Phalcon'); $I->amOnPage('/'); $I->seeInTitle('Forum - Phalcon Framework'); $I->see('Start a Discussion');