Skip to content

Firefly III: a personal finances manager

New unit tests to cover missed methods.

James Cole8e892e7ea512
diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php
index 58c3a9dfb7..d9760aab5c 100644
--- a/app/controllers/GoogleChartController.php
+++ b/app/controllers/GoogleChartController.php
@@ -97,6 +97,7 @@ class GoogleChartController extends BaseController
$this->_chart->addColumn('Balance for ' . $account->name, 'number');
}
$current = clone $this->_start;
+ $current->subDay();
while ($this->_end >= $current) {
$row = [clone $current];
diff --git a/app/database/migrations/2014_12_24_191544_changes_for_v322.php b/app/database/migrations/2014_12_24_191544_changes_for_v322.php
index 54aa328839..5fa0ed91fa 100644
--- a/app/database/migrations/2014_12_24_191544_changes_for_v322.php
+++ b/app/database/migrations/2014_12_24_191544_changes_for_v322.php
@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint;
/**
@@ -99,13 +100,16 @@ class ChangesForV322 extends Migration
Schema::table(
'budget_limits', function (Blueprint $table) {
- // try {
- //$table->dropUnique('limits_component_id_startdate_repeat_freq_unique');
- // } catch (QueryException $e) {
- //$table->dropUnique('unique_ci_combi');
- // } catch (PDOException $e) {
- // $table->dropUnique('unique_ci_combi');
- // }
+// try {
+// //$table->dropUnique('unique_ci_combi');
+// } catch (QueryException $e) {
+// echo 'Could not delete unique_ci_combi';
+//
+// } catch (PDOException $e) {
+// echo 'Could not delete unique_ci_combi';
+// } catch (Exception $e) {
+// echo 'Could not delete unique_ci_combi';
+// }
}
);
diff --git a/app/lib/FireflyIII/Report/Report.php b/app/lib/FireflyIII/Report/Report.php
index 708a84a47e..6bf0f7ed43 100644
--- a/app/lib/FireflyIII/Report/Report.php
+++ b/app/lib/FireflyIII/Report/Report.php
@@ -109,7 +109,7 @@ class Report implements ReportInterface
public function getAccountsForMonth(Carbon $date)
{
$start = clone $date;
- $start->startOfMonth();
+ $start->startOfMonth()->subDay();
$end = clone $date;
$end->endOfMonth();
$list = $this->_queries->accountList();
@@ -425,7 +425,7 @@ class Report implements ReportInterface
}
);
$report = [];
- $start->startOfYear();
+ $start->startOfYear()->subDay();
$end->endOfYear();
foreach ($accounts as $account) {
diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php
index e3ce3bcc0d..7b3950fc48 100644
--- a/app/tests/TestCase.php
+++ b/app/tests/TestCase.php
@@ -1,5 +1,7 @@
<?php
-use Mockery as m;
+
+use League\FactoryMuffin\Facade as f;
+
/**
* Class TestCase
@@ -17,39 +19,22 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
$testEnvironment = 'testing';
return require __DIR__ . '/../../bootstrap/start.php';
+
}
public function setUp()
{
parent::setUp();
- Artisan::call('migrate');
- $this->seed();
-
-
- //$this->
- }
-
- /**
- * @param $class
- *
- * @return m\MockInterface
- */
- public function mock($class)
- {
- $mock = Mockery::mock($class);
-
- $this->app->instance($class, $mock);
-
- return $mock;
}
static public function setupBeforeClass()
{
- League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories');
+ //League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories');
+ f::loadFactories(__DIR__ . '/factories');
}
public function tearDown()
{
- m::close();
+ //m::close();
}
}
\ No newline at end of file
diff --git a/app/tests/factories/Account.php b/app/tests/factories/Account.php
new file mode 100644
index 0000000000..3d4032b4d1
--- /dev/null
+++ b/app/tests/factories/Account.php
@@ -0,0 +1,10 @@
+<?php
+
+League\FactoryMuffin\Facade::define(
+ 'Account', [
+ 'user_id' => 'factory|User',
+ 'account_type_id' => 'factory|AccountType',
+ 'name' => 'word',
+ 'active' => 'boolean',
+ ]
+);
diff --git a/app/tests/factories/AccountMeta.php b/app/tests/factories/AccountMeta.php
new file mode 100644
index 0000000000..a282aa9748
--- /dev/null
+++ b/app/tests/factories/AccountMeta.php
@@ -0,0 +1,9 @@
+<?php
+
+League\FactoryMuffin\Facade::define(
+ 'AccountMeta', [
+ 'account_id' => 'factory|Account',
+ 'name' => 'word',
+ 'data' => 'text'
+ ]
+);
diff --git a/app/tests/factories/AccountType.php b/app/tests/factories/AccountType.php
new file mode 100644
index 0000000000..e893ea89af
--- /dev/null
+++ b/app/tests/factories/AccountType.php
@@ -0,0 +1,8 @@
+<?php
+
+League\FactoryMuffin\Facade::define(
+ 'AccountType', [
+ 'type' => 'word',
+ 'editable' => 'boolean'
+ ]
+);
diff --git a/codeception.yml b/codeception.yml
index f552c34999..c8dc7c62e3 100644
--- a/codeception.yml
+++ b/codeception.yml
@@ -10,13 +10,6 @@ settings:
memory_limit: 1024M
modules:
config:
- Db:
- dsn: 'sqlite:tests/_data/db.sqlite'
- user: ''
- password: ''
- dump: tests/_data/dump.sql
- cleanup: true
- populate: true
coverage:
enabled: true
remote: false
diff --git a/composer.json b/composer.json
index 005a9d3189..a1d3a88366 100644
--- a/composer.json
+++ b/composer.json
@@ -33,12 +33,14 @@
"doctrine/dbal": "~2.3",
"satooshi/php-coveralls": "dev-master",
"mockery/mockery": "@stable",
- "league/factory-muffin": "~2.0",
+ "league/factory-muffin": "~2.1",
"codeception/codeception": "*",
"codeception/c3": "2.*",
"sebastian/phpcpd": "*",
"sebastian/phpdcd": "*",
- "codeception/phpbuiltinserver": "*"
+ "codeception/phpbuiltinserver": "*",
+ "codeception/specify": "*",
+ "codeception/verify": "*"
},
"autoload": {
diff --git a/composer.lock b/composer.lock
index 0007ba9fae..084857beb1 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "9c8cafd9d3f40fa1e56b3a7cee419da5",
+ "hash": "66a93b738537ed20455648f477585c88",
"packages": [
{
"name": "classpreloader/classpreloader",
@@ -2104,6 +2104,77 @@
],
"time": "2014-09-19 10:14:07"
},
+ {
+ "name": "codeception/specify",
+ "version": "0.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Codeception/Specify.git",
+ "reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Codeception/Specify/zipball/0c0ae07adfc231115b3b72ade22f44c23c199ded",
+ "reference": "0c0ae07adfc231115b3b72ade22f44c23c199ded",
+ "shasum": ""
+ },
+ "require": {
+ "myclabs/deep-copy": "~1.1",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Codeception\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "Michael Bodnarchuk",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "BDD code blocks for PHPUnit and Codeception",
+ "time": "2014-10-17 00:06:51"
+ },
+ {
+ "name": "codeception/verify",
+ "version": "0.2.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Codeception/Verify.git",
+ "reference": "66e5074905f4d9590ddb805d123fe632f4baa488"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Codeception/Verify/zipball/66e5074905f4d9590ddb805d123fe632f4baa488",
+ "reference": "66e5074905f4d9590ddb805d123fe632f4baa488",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/Codeception/function.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "Michael Bodnarchuk",
+ "email": "[email protected]",
+ "homepage": "http://codeception.com"
+ }
+ ],
+ "description": "BDD assertion library for PHPUnit",
+ "time": "2014-01-22 14:40:33"
+ },
{
"name": "doctrine/annotations",
"version": "v1.2.3",
@@ -3153,6 +3224,48 @@
],
"time": "2014-12-22 10:06:19"
},
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3",
+ "reference": "d93c485e71bcd22df0a994e9e3e03a3ef3a3e3f3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "doctrine/collections": "1.*",
+ "phpunit/phpunit": "~4.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "homepage": "https://github.com/myclabs/DeepCopy",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "time": "2014-11-20 05:11:17"
+ },
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.3",
@@ -4122,16 +4235,16 @@
},
{
"name": "sebastian/version",
- "version": "1.0.3",
+ "version": "1.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
- "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
+ "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
- "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
+ "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
"shasum": ""
},
"type": "library",
@@ -4153,7 +4266,7 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
- "time": "2014-03-07 15:35:33"
+ "time": "2014-12-15 14:25:24"
},
{
"name": "symfony/class-loader",
diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php
index bc088a8f9e..2a9ae24d6c 100644
--- a/tests/_bootstrap.php
+++ b/tests/_bootstrap.php
@@ -1,21 +1,9 @@
<?php
-$db = realpath(__DIR__ . '/_data') . '/db.sqlite';
-if(!file_exists($db)) {
- exec('touch '.$db);
- exec('php artisan migrate --seed --env=testing');
- exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql');
+$db = realpath(__DIR__ . '/_data') . '/db.sqlite';
+$dump = realpath(__DIR__ . '/_data') . '/dump.sql';
+if (!file_exists($db)) {
+ $out = [];
+ exec('touch ' . $db);
+ exec('php artisan migrate --seed --env=testing', $out);
+ exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql', $out);
}
-
-/**
- * Class resetToClean
- */
-class resetToClean
-{
- /**
- *
- */
- static public function clean()
- {
- //exec('cp ' . realpath(__DIR__ . '/_data') . '/clean.sqlite ' . realpath(__DIR__ . '/_data') . '/testing.sqlite');
- }
-}
\ No newline at end of file
diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml
index 4d61ccdd3f..db06c29796 100644
--- a/tests/functional.suite.yml
+++ b/tests/functional.suite.yml
@@ -11,6 +11,10 @@ modules:
Db:
populate: false
cleanup: true
+ dsn: 'sqlite:tests/_data/db.sqlite'
+ user: ''
+ password: ''
+ dump: tests/_data/dump.sql
Laravel4:
environment: 'testing'
filters: false
\ No newline at end of file
diff --git a/tests/functional/AccountControllerCest.php b/tests/functional/AccountControllerCest.php
index 103dd6c9b2..6577b9ef6d 100644
--- a/tests/functional/AccountControllerCest.php
+++ b/tests/functional/AccountControllerCest.php
@@ -55,7 +55,6 @@ class AccountControllerCest
$I->see('Delete account "Delete me"');
$I->submitForm('#destroy', []);
$I->dontSeeRecord('accounts', ['id' => 3, 'deleted_at' => null]);
- resetToClean::clean();
}
/**
@@ -113,7 +112,6 @@ class AccountControllerCest
$I->see('Create a new asset account');
$I->submitForm('#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'store']);
$I->seeRecord('accounts', ['name' => 'New through tests.']);
- resetToClean::clean();
}
/**
@@ -128,7 +126,6 @@ class AccountControllerCest
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'create_another']
);
$I->seeRecord('accounts', ['name' => 'New through tests.']);
- resetToClean::clean();
}
/**
@@ -141,7 +138,6 @@ class AccountControllerCest
$I->see('Create a new asset account');
$I->submitForm('#store', ['name' => null, 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
- resetToClean::clean();
}
/**
@@ -156,7 +152,6 @@ class AccountControllerCest
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
);
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
- resetToClean::clean();
}
/**
@@ -169,7 +164,6 @@ class AccountControllerCest
$I->see('Edit asset account "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']);
$I->seeRecord('accounts', ['name' => 'Update me']);
- resetToClean::clean();
}
@@ -185,7 +179,6 @@ class AccountControllerCest
'#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'return_to_edit']
);
$I->seeRecord('accounts', ['name' => 'Savings accountXX']);
- resetToClean::clean();
}
diff --git a/tests/functional/BudgetControllerCest.php b/tests/functional/BudgetControllerCest.php
index 3e9d2ec79e..79400e7f9a 100644
--- a/tests/functional/BudgetControllerCest.php
+++ b/tests/functional/BudgetControllerCest.php
@@ -148,7 +148,6 @@ class BudgetControllerCest
$I->see('Create a new budget');
$I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'store']);
$I->seeRecord('budgets', ['name' => 'New budget.']);
- resetToClean::clean();
}
/**
@@ -197,7 +196,6 @@ class BudgetControllerCest
$I->see('Edit budget "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
$I->seeRecord('budgets', ['name' => 'Update me']);
- resetToClean::clean();
}
diff --git a/tests/functional/CategoryControllerCest.php b/tests/functional/CategoryControllerCest.php
index 8c688fcabb..d3452276a0 100644
--- a/tests/functional/CategoryControllerCest.php
+++ b/tests/functional/CategoryControllerCest.php
@@ -107,7 +107,6 @@ class CategoryControllerCest
$I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'store']);
$I->seeRecord('categories', ['name' => 'New category.']);
- resetToClean::clean();
}
/**
@@ -120,7 +119,6 @@ class CategoryControllerCest
$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();
}
/**
@@ -133,7 +131,6 @@ class CategoryControllerCest
$I->see('Create a new category');
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('categories', ['name' => 'New category.']);
- resetToClean::clean();
}
/**
@@ -146,7 +143,6 @@ class CategoryControllerCest
$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();
}
/**
@@ -159,7 +155,6 @@ class CategoryControllerCest
$I->see('Edit category "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
$I->seeRecord('categories', ['name' => 'Update me']);
- resetToClean::clean();
}
diff --git a/tests/functional/CurrencyControllerCest.php b/tests/functional/CurrencyControllerCest.php
index a5e6726a59..b8b9ed7845 100644
--- a/tests/functional/CurrencyControllerCest.php
+++ b/tests/functional/CurrencyControllerCest.php
@@ -168,7 +168,6 @@ class CurrencyControllerCest
$I->see('Edit currency "US Dollar"');
$I->submitForm('#update', ['name' => 'Successful update', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'update']);
$I->seeRecord('transaction_currencies', ['name' => 'Successful update']);
- resetToClean::clean();
}
diff --git a/tests/functional/TransactionControllerCest.php b/tests/functional/TransactionControllerCest.php
index dcaf3727fd..30456cc9d6 100644
--- a/tests/functional/TransactionControllerCest.php
+++ b/tests/functional/TransactionControllerCest.php
@@ -46,7 +46,10 @@ class TransactionControllerCest
public function destroyTransfer(FunctionalTester $I)
{
$I->wantTo('destroy a transfer');
- $I->amOnPage('/transaction/delete/406');
+
+ $journal = TransactionJournal::whereDescription('Money for new PC')->first();
+
+ $I->amOnPage('/transaction/delete/' . $journal->id);
$I->submitForm('#destroy', []);
$I->see('Transaction &quot;Money for new PC&quot; destroyed.');
@@ -63,8 +66,9 @@ class TransactionControllerCest
public function edit(FunctionalTester $I)
{
+ $journal = TransactionJournal::whereDescription('Money for piggy')->first();
$I->wantTo('edit a transaction');
- $I->amOnPage('/transaction/edit/408');
+ $I->amOnPage('/transaction/edit/' . $journal->id);
$I->see('Edit transfer &quot;Money for piggy&quot;');
}
@@ -91,8 +95,10 @@ class TransactionControllerCest
public function show(FunctionalTester $I)
{
+ $journal = TransactionJournal::whereDescription('Money for new PC')->first();
+
$I->wantTo('see a transaction');
- $I->amOnPage('/transaction/show/406');
+ $I->amOnPage('/transaction/show/' . $journal->id);
$I->see('Transfer "Money for new PC"');
$I->see('1.259');
}
@@ -117,45 +123,44 @@ class TransactionControllerCest
$I->see('Transaction &quot;Test&quot; stored.');
}
- public function storeAndReturn(FunctionalTester $I)
+ public function storeAndFail(FunctionalTester $I)
{
- $I->wantTo('store a transaction');
+ $I->wantTo('store a transaction and fail');
$I->amOnPage('/transactions/create/withdrawal');
$I->submitForm(
'#store', [
'reminder' => '',
- 'description' => 'Test',
+ 'description' => '',
'account_id' => 1,
'expense_account' => 'Zomaar',
'amount' => 100,
'date' => '2014-12-30',
'budget_id' => 3,
'category' => 'Categorrr',
- 'post_submit_action' => 'create_another'
+ 'post_submit_action' => 'store'
]
);
- $I->see('Transaction &quot;Test&quot; stored.');
+ $I->see('Could not store transaction: The description field is required.');
}
-
- public function storeAndFail(FunctionalTester $I)
+ public function storeAndReturn(FunctionalTester $I)
{
- $I->wantTo('store a transaction and fail');
+ $I->wantTo('store a transaction');
$I->amOnPage('/transactions/create/withdrawal');
$I->submitForm(
'#store', [
'reminder' => '',
- 'description' => '',
+ 'description' => 'Test',
'account_id' => 1,
'expense_account' => 'Zomaar',
'amount' => 100,
'date' => '2014-12-30',
'budget_id' => 3,
'category' => 'Categorrr',
- 'post_submit_action' => 'store'
+ 'post_submit_action' => 'create_another'
]
);
- $I->see('Could not store transaction: The description field is required.');
+ $I->see('Transaction &quot;Test&quot; stored.');
}
public function update(FunctionalTester $I)
diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php
index 8a88555806..c25406adad 100644
--- a/tests/functional/_bootstrap.php
+++ b/tests/functional/_bootstrap.php
@@ -1,2 +1,8 @@
<?php
-// Here you can initialize variables that will be available to your tests
+$db = realpath(__DIR__ . '/../_data') . '/db.sqlite';
+if (!file_exists($db)) {
+ $out = [];
+ exec('touch ' . $db);
+ exec('php artisan migrate --seed --env=testing', $out);
+ exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql', $out);
+}
\ No newline at end of file
diff --git a/tests/unit/AccountTest.php b/tests/unit/AccountTest.php
new file mode 100644
index 0000000000..5ffff946c7
--- /dev/null
+++ b/tests/unit/AccountTest.php
@@ -0,0 +1,40 @@
+<?php
+use League\FactoryMuffin\Facade as f;
+
+/**
+ * Class AccountTest
+ */
+class AccountTest extends TestCase
+{
+
+ public function setUp()
+ {
+ parent::setUp();
+ }
+
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
+
+ // tests
+
+ public function testAccountMeta()
+ {
+ $account = f::create('Account');
+ $newMeta = $account->updateMeta('field', 'value');
+ $this->assertInstanceOf('AccountMeta', $newMeta);
+ $secondMeta = $account->updateMeta('field', 'newValue');
+ $this->assertEquals($newMeta->id, $secondMeta->id);
+ $this->assertEquals($newMeta->data, 'value');
+ $this->assertEquals($secondMeta->data, 'newValue');
+ }
+
+ public function testAccountUser()
+ {
+ $account = f::create('Account');
+ $this->assertInstanceOf('Account', $account);
+ $this->assertInstanceOf('User', $account->user);
+ }
+
+}
\ No newline at end of file
diff --git a/tests/unit/ExamplATest.php b/tests/unit/ExamplATest.php
new file mode 100644
index 0000000000..40e171dbf2
--- /dev/null
+++ b/tests/unit/ExamplATest.php
@@ -0,0 +1,18 @@
+<?php
+
+class ExamplATest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ }
+
+ protected function tearDown()
+ {
+ }
+
+ // tests
+ public function testMe()
+ {
+ }
+
+}
\ No newline at end of file