Category controller covered.

This commit is contained in:
James Cole
2014-12-20 16:53:32 +01:00
parent 1484621300
commit 7b4703e4ff
10 changed files with 152 additions and 53 deletions

View File

@@ -70,8 +70,6 @@ class BudgetControllerCest
$I->see('Delete budget "Delete me"');
$I->submitForm('#destroy', []);
$I->see('Budget "Delete me" was deleted.');
#$I->dontSeeInDatabase('budgets', ['name' => 'Delete me','deleted_at' => null]);
resetToClean::clean();
}
/**
@@ -80,7 +78,8 @@ class BudgetControllerCest
public function edit(FunctionalTester $I)
{
$I->wantTo('edit a budget');
$I->amOnPage('/budgets/edit/1');
$I->amOnPage('/budgets/edit/3');
$I->see('Edit budget "Delete me"');
}
/**
@@ -111,7 +110,8 @@ class BudgetControllerCest
public function show(FunctionalTester $I)
{
$I->wantTo('show a budget');
$I->amOnPage('/budgets/show/1');
$I->amOnPage('/budgets/show/3');
$I->see('Delete me');
}
/**

View File

@@ -38,6 +38,8 @@ class CategoryControllerCest
public function delete(FunctionalTester $I)
{
$I->wantTo('delete a category');
$I->amOnPage('/categories/delete/4');
$I->see('Delete category "Delete me"');
}
/**
@@ -46,6 +48,10 @@ class CategoryControllerCest
public function destroy(FunctionalTester $I)
{
$I->wantTo('destroy a category');
$I->amOnPage('/categories/delete/4');
$I->see('Delete category "Delete me"');
$I->submitForm('#destroy', []);
$I->see('Category "Delete me" was deleted.');
}
@@ -55,6 +61,8 @@ class CategoryControllerCest
public function edit(FunctionalTester $I)
{
$I->wantTo('edit a category');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
}
/**
@@ -72,6 +80,8 @@ class CategoryControllerCest
public function show(FunctionalTester $I)
{
$I->wantTo('show a category');
$I->amOnPage('/categories/show/3');
$I->see('Delete me');
}
/**
@@ -79,15 +89,108 @@ class CategoryControllerCest
*/
public function store(FunctionalTester $I)
{
$I->wantTo('store a category');
$I->amOnPage('/categories/create');
$I->wantTo('store a new category');
$I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'store']);
$I->seeRecord('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
*/
public function storeAndCreateAnother(FunctionalTester $I)
{
$I->amOnPage('/categories/create');
$I->wantTo('store a new category and create another');
$I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'create_another']);
$I->seeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
public function storeFail(FunctionalTester $I)
{
$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->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
}
/**
* @param FunctionalTester $I
*/
public function update(FunctionalTester $I)
{
$I->wantTo('update a category');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
$I->seeRecord('categories', ['name' => 'Update me']);
resetToClean::clean();
}
/**
* @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
*/
public function validateUpdateOnly(FunctionalTester $I)
{
$I->wantTo('update a category and validate only');
$I->amOnPage('/categories/edit/4');
$I->see('Edit category "Delete me"');
$I->submitForm(
'#update', ['name' => 'Validate Only', 'post_submit_action' => 'validate_only']
);
$I->dontSeeRecord('categories', ['name' => 'Savings accountXX']);
$I->seeRecord('categories', ['name' => 'Delete me']);
}
/**
* @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']);
}
}