/** * @param FunctionalTester $I */ public function testUpdate(FunctionalTester $I) { $I->wantTo('ensure that create post-type works'); $updatePage = UpdatePage::openBy($I); $I->see('Update Post Type: Post', 'h1'); $I->amGoingTo('submit post-type form with correct data'); $I->checkOption('#posttype-post_type_smb'); $I->selectOption('#posttype-post_type_permission', 'subscriber'); $updatePage->submitPostType(['post_type_description' => 'New post-type description']); $I->expectTo('post-type updated'); // $I->see('View Post Type: Post', 'h1'); $I->see('View Post Type: Post'); PostType::findOne(1)->update(['post_type_smb' => '0', 'post_type_permission' => 'contributor', 'post_type_description' => '']); Taxonomy::deleteAll(['taxonomy_name' => 'test-taxonomy']); }
/** * @param AcceptanceTester $I */ public function testCreate(AcceptanceTester $I) { $I->wantTo('ensure that create taxonomy works'); $createPage = CreatePage::openBy($I); $I->see('Add New Taxonomy'); $I->amGoingTo('submit taxonomy form with empty data'); $createPage->submit([]); $I->expectTo('see error messages'); $I->see('Name cannot be blank.', '.help-block'); $I->see('Singular Name cannot be blank.', '.help-block'); $I->see('Plural Name cannot be blank.', '.help-block'); $I->amGoingTo('submit taxonomy form with already stored data'); $createPage->submit(['name' => 'category', 'slug' => 'category', 'singular_name' => 'Category', 'plural_name' => 'Categories']); $I->expectTo('see error messages'); $I->see('Name "category" has already been taken.', '.help-block'); $I->see('Slug "category" has already been taken.', '.help-block'); $I->amGoingTo('submit taxonomy with correct'); $createPage->submit(['name' => 'test', 'slug' => 'test', 'singular_name' => 'Test', 'plural_name' => 'Tests']); $I->expect('new taxonomy saved'); $I->see('View Taxonomy: Test', 'h1'); Taxonomy::deleteAll(['name' => 'test']); }
/** * @param AcceptanceTester $I */ public function testUpdate(AcceptanceTester $I) { $I->wantTo('ensure that create post-type works'); $updatePage = UpdatePage::openBy($I); $I->see('Update Post Type: Post', 'h1'); // Only run for selenium if (method_exists($I, 'executeJS')) { $I->amGoingTo('submit taxonomy with no data'); $updatePage->submitTaxonomy([]); $I->expectTo('see validation errors'); $I->see('Name cannot be blank.', '.help-block'); $I->see('Singular Name cannot be blank.', '.help-block'); $I->see('Plural Name cannot be blank.', '.help-block'); $I->amGoingTo('submit taxonomy with correct data'); $updatePage->submitTaxonomy(['taxonomy_name' => 'test-taxonomy', 'taxonomy_sn' => 'Test Taxonomy', 'taxonomy_pn' => 'Test Taxonomies']); $I->expect('new taxonomy saved'); $I->see('test-taxonomy', '#taxonomy_list'); $I->dontSee('Name cannot be blank.', '.help-block'); $I->dontSee('Singular Name cannot be blank.', '.help-block'); $I->dontSee('Plural Name cannot be blank.', '.help-block'); } // Test update data $I->amGoingTo('submit post-type form with correct data'); $I->checkOption('#posttype-post_type_smb'); $I->selectOption('#posttype-post_type_permission', 'subscriber'); $updatePage->submitPostType(['post_type_description' => 'New post-type description']); $I->expectTo('post-type updated'); $I->see('View Post Type: Post', 'h1'); PostType::findOne(1)->update(['post_type_smb' => '0', 'post_type_permission' => 'contributor', 'post_type_description' => '']); Taxonomy::deleteAll(['taxonomy_name' => 'test-taxonomy']); }