From 35c90a32e96671f187f3076ddb68f10dae2345f3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 3 Jul 2014 11:11:21 +0200 Subject: [PATCH] Finished user model, started account and others but we'll save those. --- app/models/Elegant.php | 2 +- app/tests/models/UserTest.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/models/Elegant.php b/app/models/Elegant.php index 8d4bc8b4ac..ebe6805cfe 100644 --- a/app/models/Elegant.php +++ b/app/models/Elegant.php @@ -1,6 +1,6 @@ assertEquals($errors[0], "The email field is required."); } + /** + * Test accounts + */ + public function testUserAccounts() + { + // Create a new User + $user = new User; + $user->email = 'bla'; + $user->password = 'bla'; + $user->migrated = 0; + $user->save(); + + // account type: + $at = new AccountType; + $at->description = 'Bla'; + $at->save(); + + + $account = new Account; + $account->name = 'bla'; + $account->active = 1; + $account->accountType()->associate($at); + $account->user()->associate($user); + + $account->save(); + + + + $this->assertCount(1,$user->accounts()->get()); + + + } + } \ No newline at end of file