Some refactoring.

This commit is contained in:
James Cole
2014-12-30 18:44:58 +01:00
parent 94fcfacec4
commit 8c3ae40de1
26 changed files with 327 additions and 329 deletions

View File

@@ -65,6 +65,19 @@ class CategoryControllerCest
$I->see('Edit category "Delete me"');
}
/**
* @param FunctionalTester $I
*/
public function failUpdate(FunctionalTester $I)
{
$I->wantTo('update a category and fail');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
$I->seeRecord('categories', ['name' => 'Delete me']);
}
/**
* @param FunctionalTester $I
*/
@@ -97,19 +110,6 @@ class CategoryControllerCest
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
public function storeValidateOnly(FunctionalTester $I)
{
$I->amOnPage('/categories/create');
$I->wantTo('validate a new category');
$I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
@@ -131,10 +131,24 @@ class CategoryControllerCest
$I->amOnPage('/categories/create');
$I->wantTo('make storing a new category fail.');
$I->see('Create a new category');
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
public function storeValidateOnly(FunctionalTester $I)
{
$I->amOnPage('/categories/create');
$I->wantTo('validate a new category');
$I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
@@ -152,13 +166,15 @@ class CategoryControllerCest
/**
* @param FunctionalTester $I
*/
public function failUpdate(FunctionalTester $I)
public function updateAndReturn(FunctionalTester $I)
{
$I->wantTo('update a category and fail');
$I->wantTo('update a category and return to form');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
$I->seeRecord('categories', ['name' => 'Delete me']);
$I->submitForm(
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
);
$I->seeRecord('categories', ['name' => 'Savings accountXX']);
}
@@ -178,19 +194,4 @@ class CategoryControllerCest
}
/**
* @param FunctionalTester $I
*/
public function updateAndReturn(FunctionalTester $I)
{
$I->wantTo('update a category and return to form');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
$I->submitForm(
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
);
$I->seeRecord('categories', ['name' => 'Savings accountXX']);
}
}