A free open source IT asset/license management system
Fix Functional Tests.
Daniel Meltzer05187eb27fa4
diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.phpindex bf8ca1c93d..6d354869d3 100755--- a/app/Http/Controllers/Assets/AssetsController.php+++ b/app/Http/Controllers/Assets/AssetsController.php@@ -802,4 +802,4 @@ class AssetsController extends Controllerreturn view('hardware/requested', compact('requestedItems'));}-}\ No newline at end of file+}diff --git a/tests/functional/AssetsCest.php b/tests/functional/AssetsCest.phpindex 5ff47e5dba..55501c7336 100644--- a/tests/functional/AssetsCest.php+++ b/tests/functional/AssetsCest.php@@ -22,8 +22,11 @@ class AssetsCestpublic function failsEmptyValidation(FunctionalTester $I){+$I->wantTo("Test Validation Fails with blank elements");$I->amOnPage(route('hardware.create'));+ // Settings factory can enable auto prefixes, which generate a random asset id. Lets clear it out for the sake of this test.+ $I->fillField('#asset_tag', '');$I->click('Save');$I->see('The asset tag field is required.', '.alert-msg');$I->see('The model id field is required.', '.alert-msg');@@ -40,7 +43,7 @@ class AssetsCest]);$userId = $I->getUserId();$values = [- 'asset_tag' => $asset->asset_tag,+ 'asset_tags[1]' => $asset->asset_tag,'assigned_user' => $userId,'company_id' => $asset->company_id,'model_id' => $asset->model_id,@@ -51,7 +54,7 @@ class AssetsCest'purchase_date' => '2016-01-01','requestable' => $asset->requestable,'rtd_location_id' => $asset->rtd_location_id,- 'serial' => $asset->serial,+ 'serials[1]' => $asset->serial,'status_id' => $asset->status_id,'supplier_id' => $asset->supplier_id,'warranty_months' => $asset->warranty_months,@@ -67,7 +70,7 @@ class AssetsCest'notes' => $asset->notes,'order_number' => $asset->order_number,'purchase_cost' => $asset->purchase_cost,- 'purchase_date' => Carbon::parse('2016-01-01'),+ 'purchase_date' => '2016-01-01','requestable' => $asset->requestable,'rtd_location_id' => $asset->rtd_location_id,'serial' => $asset->serial,@@ -80,7 +83,7 @@ class AssetsCest$I->amOnPage(route('hardware.create'));$I->submitForm('form#create-form', $values);$I->seeRecord('assets', $seenValues);- $I->dontSeeElement('.alert-danger'); // We should check for success, but we can't because of the stupid ajaxy way I did things. FIXME when the asset form is rewritten.+ $I->seeResponseCodeIs(200);}public function allowsDelete(FunctionalTester $I)diff --git a/tests/functional/GroupsCest.php b/tests/functional/GroupsCest.phpindex b24b3c07cc..724b4dbca1 100644--- a/tests/functional/GroupsCest.php+++ b/tests/functional/GroupsCest.php@@ -39,10 +39,10 @@ class GroupsCest$I->wantTo("Test Validation Fails with short name");$I->amOnPage(route('groups.create'));$I->seeResponseCodeIs(200);- $I->fillField('name', 't2');+ $I->fillField('name', 't');$I->click('Save');$I->seeElement('.alert-danger');- $I->see('The name must be at least 3 characters', '.alert-msg');+ $I->see('The name must be at least 2 characters', '.alert-msg');}public function passesCorrectValidation(FunctionalTester $I)diff --git a/tests/functional/UsersCest.php b/tests/functional/UsersCest.phpindex 40e8d7e7ff..42ca897342 100644--- a/tests/functional/UsersCest.php+++ b/tests/functional/UsersCest.php@@ -42,7 +42,7 @@ class UsersCest$I->fillField('password', '12345');$I->click('Save');$I->seeElement('.alert-danger');- $I->see('The password must be at least 10 characters', '.alert-msg');+ $I->see('The password must be at least 8 characters', '.alert-msg');}public function passesCorrectValidation(FunctionalTester $I)diff --git a/tests/unit/LocationTest.php b/tests/unit/LocationTest.phpindex 09cf2ff589..82f0a14ef1 100644--- a/tests/unit/LocationTest.php+++ b/tests/unit/LocationTest.php@@ -13,6 +13,7 @@ class LocationTest extends BaseTestprotected $tester;public function testPassesIfNotSelfParent() {+ $this->createValidLocation(['id' => 10]);$a = factory(Location::class)->make(['name' => 'Test Location',