New unit tests to cover missed methods.

This commit is contained in:
James Cole 2015-01-01 12:06:42 +01:00
parent 3386c8b455
commit 8e892e7ea5
20 changed files with 276 additions and 105 deletions

View File

@ -97,6 +97,7 @@ class GoogleChartController extends BaseController
$this->_chart->addColumn('Balance for ' . $account->name, 'number'); $this->_chart->addColumn('Balance for ' . $account->name, 'number');
} }
$current = clone $this->_start; $current = clone $this->_start;
$current->subDay();
while ($this->_end >= $current) { while ($this->_end >= $current) {
$row = [clone $current]; $row = [clone $current];

View File

@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
/** /**
@ -99,13 +100,16 @@ class ChangesForV322 extends Migration
Schema::table( Schema::table(
'budget_limits', function (Blueprint $table) { 'budget_limits', function (Blueprint $table) {
// try { // try {
//$table->dropUnique('limits_component_id_startdate_repeat_freq_unique'); // //$table->dropUnique('unique_ci_combi');
// } catch (QueryException $e) { // } catch (QueryException $e) {
//$table->dropUnique('unique_ci_combi'); // echo 'Could not delete unique_ci_combi';
// } catch (PDOException $e) { //
// $table->dropUnique('unique_ci_combi'); // } catch (PDOException $e) {
// } // echo 'Could not delete unique_ci_combi';
// } catch (Exception $e) {
// echo 'Could not delete unique_ci_combi';
// }
} }
); );

View File

@ -109,7 +109,7 @@ class Report implements ReportInterface
public function getAccountsForMonth(Carbon $date) public function getAccountsForMonth(Carbon $date)
{ {
$start = clone $date; $start = clone $date;
$start->startOfMonth(); $start->startOfMonth()->subDay();
$end = clone $date; $end = clone $date;
$end->endOfMonth(); $end->endOfMonth();
$list = $this->_queries->accountList(); $list = $this->_queries->accountList();
@ -425,7 +425,7 @@ class Report implements ReportInterface
} }
); );
$report = []; $report = [];
$start->startOfYear(); $start->startOfYear()->subDay();
$end->endOfYear(); $end->endOfYear();
foreach ($accounts as $account) { foreach ($accounts as $account) {

View File

@ -1,5 +1,7 @@
<?php <?php
use Mockery as m;
use League\FactoryMuffin\Facade as f;
/** /**
* Class TestCase * Class TestCase
@ -17,39 +19,22 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
$testEnvironment = 'testing'; $testEnvironment = 'testing';
return require __DIR__ . '/../../bootstrap/start.php'; return require __DIR__ . '/../../bootstrap/start.php';
} }
public function setUp() public function setUp()
{ {
parent::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() static public function setupBeforeClass()
{ {
League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories'); //League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories');
f::loadFactories(__DIR__ . '/factories');
} }
public function tearDown() public function tearDown()
{ {
m::close(); //m::close();
} }
} }

View File

@ -0,0 +1,10 @@
<?php
League\FactoryMuffin\Facade::define(
'Account', [
'user_id' => 'factory|User',
'account_type_id' => 'factory|AccountType',
'name' => 'word',
'active' => 'boolean',
]
);

View File

@ -0,0 +1,9 @@
<?php
League\FactoryMuffin\Facade::define(
'AccountMeta', [
'account_id' => 'factory|Account',
'name' => 'word',
'data' => 'text'
]
);

View File

@ -0,0 +1,8 @@
<?php
League\FactoryMuffin\Facade::define(
'AccountType', [
'type' => 'word',
'editable' => 'boolean'
]
);

View File

@ -10,13 +10,6 @@ settings:
memory_limit: 1024M memory_limit: 1024M
modules: modules:
config: config:
Db:
dsn: 'sqlite:tests/_data/db.sqlite'
user: ''
password: ''
dump: tests/_data/dump.sql
cleanup: true
populate: true
coverage: coverage:
enabled: true enabled: true
remote: false remote: false

View File

@ -33,12 +33,14 @@
"doctrine/dbal": "~2.3", "doctrine/dbal": "~2.3",
"satooshi/php-coveralls": "dev-master", "satooshi/php-coveralls": "dev-master",
"mockery/mockery": "@stable", "mockery/mockery": "@stable",
"league/factory-muffin": "~2.0", "league/factory-muffin": "~2.1",
"codeception/codeception": "*", "codeception/codeception": "*",
"codeception/c3": "2.*", "codeception/c3": "2.*",
"sebastian/phpcpd": "*", "sebastian/phpcpd": "*",
"sebastian/phpdcd": "*", "sebastian/phpdcd": "*",
"codeception/phpbuiltinserver": "*" "codeception/phpbuiltinserver": "*",
"codeception/specify": "*",
"codeception/verify": "*"
}, },
"autoload": { "autoload": {

125
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "9c8cafd9d3f40fa1e56b3a7cee419da5", "hash": "66a93b738537ed20455648f477585c88",
"packages": [ "packages": [
{ {
"name": "classpreloader/classpreloader", "name": "classpreloader/classpreloader",
@ -2104,6 +2104,77 @@
], ],
"time": "2014-09-19 10:14:07" "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": "davert.php@mailican.com"
}
],
"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": "davert.php@mailican.com",
"homepage": "http://codeception.com"
}
],
"description": "BDD assertion library for PHPUnit",
"time": "2014-01-22 14:40:33"
},
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
"version": "v1.2.3", "version": "v1.2.3",
@ -3153,6 +3224,48 @@
], ],
"time": "2014-12-22 10:06:19" "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", "name": "phpdocumentor/reflection-docblock",
"version": "2.0.3", "version": "2.0.3",
@ -4122,16 +4235,16 @@
}, },
{ {
"name": "sebastian/version", "name": "sebastian/version",
"version": "1.0.3", "version": "1.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/version.git", "url": "https://github.com/sebastianbergmann/version.git",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -4153,7 +4266,7 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-03-07 15:35:33" "time": "2014-12-15 14:25:24"
}, },
{ {
"name": "symfony/class-loader", "name": "symfony/class-loader",

View File

@ -1,21 +1,9 @@
<?php <?php
$db = realpath(__DIR__ . '/_data') . '/db.sqlite'; $db = realpath(__DIR__ . '/_data') . '/db.sqlite';
if(!file_exists($db)) { $dump = realpath(__DIR__ . '/_data') . '/dump.sql';
exec('touch '.$db); if (!file_exists($db)) {
exec('php artisan migrate --seed --env=testing'); $out = [];
exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql'); 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');
}
}

View File

@ -11,6 +11,10 @@ modules:
Db: Db:
populate: false populate: false
cleanup: true cleanup: true
dsn: 'sqlite:tests/_data/db.sqlite'
user: ''
password: ''
dump: tests/_data/dump.sql
Laravel4: Laravel4:
environment: 'testing' environment: 'testing'
filters: false filters: false

View File

@ -55,7 +55,6 @@ class AccountControllerCest
$I->see('Delete account "Delete me"'); $I->see('Delete account "Delete me"');
$I->submitForm('#destroy', []); $I->submitForm('#destroy', []);
$I->dontSeeRecord('accounts', ['id' => 3, 'deleted_at' => null]); $I->dontSeeRecord('accounts', ['id' => 3, 'deleted_at' => null]);
resetToClean::clean();
} }
/** /**
@ -113,7 +112,6 @@ class AccountControllerCest
$I->see('Create a new asset account'); $I->see('Create a new asset account');
$I->submitForm('#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'store']); $I->submitForm('#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'store']);
$I->seeRecord('accounts', ['name' => 'New through tests.']); $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'] '#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'create_another']
); );
$I->seeRecord('accounts', ['name' => 'New through tests.']); $I->seeRecord('accounts', ['name' => 'New through tests.']);
resetToClean::clean();
} }
/** /**
@ -141,7 +138,6 @@ class AccountControllerCest
$I->see('Create a new asset account'); $I->see('Create a new asset account');
$I->submitForm('#store', ['name' => null, 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']); $I->submitForm('#store', ['name' => null, 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']); $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'] '#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
); );
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']); $I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
resetToClean::clean();
} }
/** /**
@ -169,7 +164,6 @@ class AccountControllerCest
$I->see('Edit asset account "Delete me"'); $I->see('Edit asset account "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']); $I->submitForm('#update', ['name' => 'Update me', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']);
$I->seeRecord('accounts', ['name' => 'Update me']); $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'] '#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'return_to_edit']
); );
$I->seeRecord('accounts', ['name' => 'Savings accountXX']); $I->seeRecord('accounts', ['name' => 'Savings accountXX']);
resetToClean::clean();
} }

View File

@ -148,7 +148,6 @@ class BudgetControllerCest
$I->see('Create a new budget'); $I->see('Create a new budget');
$I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'store']); $I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'store']);
$I->seeRecord('budgets', ['name' => 'New budget.']); $I->seeRecord('budgets', ['name' => 'New budget.']);
resetToClean::clean();
} }
/** /**
@ -197,7 +196,6 @@ class BudgetControllerCest
$I->see('Edit budget "Delete me"'); $I->see('Edit budget "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']); $I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
$I->seeRecord('budgets', ['name' => 'Update me']); $I->seeRecord('budgets', ['name' => 'Update me']);
resetToClean::clean();
} }

View File

@ -107,7 +107,6 @@ class CategoryControllerCest
$I->see('Create a new category'); $I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'store']); $I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'store']);
$I->seeRecord('categories', ['name' => 'New category.']); $I->seeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
} }
/** /**
@ -120,7 +119,6 @@ class CategoryControllerCest
$I->see('Create a new category'); $I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'create_another']); $I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'create_another']);
$I->seeRecord('categories', ['name' => 'New category.']); $I->seeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
} }
/** /**
@ -133,7 +131,6 @@ class CategoryControllerCest
$I->see('Create a new category'); $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.']); $I->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
} }
/** /**
@ -146,7 +143,6 @@ class CategoryControllerCest
$I->see('Create a new category'); $I->see('Create a new category');
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']); $I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
$I->dontSeeRecord('categories', ['name' => 'New category.']); $I->dontSeeRecord('categories', ['name' => 'New category.']);
resetToClean::clean();
} }
/** /**
@ -159,7 +155,6 @@ class CategoryControllerCest
$I->see('Edit category "Delete me"'); $I->see('Edit category "Delete me"');
$I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']); $I->submitForm('#update', ['name' => 'Update me', 'post_submit_action' => 'update']);
$I->seeRecord('categories', ['name' => 'Update me']); $I->seeRecord('categories', ['name' => 'Update me']);
resetToClean::clean();
} }

View File

@ -168,7 +168,6 @@ class CurrencyControllerCest
$I->see('Edit currency "US Dollar"'); $I->see('Edit currency "US Dollar"');
$I->submitForm('#update', ['name' => 'Successful update', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'update']); $I->submitForm('#update', ['name' => 'Successful update', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'update']);
$I->seeRecord('transaction_currencies', ['name' => 'Successful update']); $I->seeRecord('transaction_currencies', ['name' => 'Successful update']);
resetToClean::clean();
} }

View File

@ -46,7 +46,10 @@ class TransactionControllerCest
public function destroyTransfer(FunctionalTester $I) public function destroyTransfer(FunctionalTester $I)
{ {
$I->wantTo('destroy a transfer'); $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->submitForm('#destroy', []);
$I->see('Transaction &quot;Money for new PC&quot; destroyed.'); $I->see('Transaction &quot;Money for new PC&quot; destroyed.');
@ -63,8 +66,9 @@ class TransactionControllerCest
public function edit(FunctionalTester $I) public function edit(FunctionalTester $I)
{ {
$journal = TransactionJournal::whereDescription('Money for piggy')->first();
$I->wantTo('edit a transaction'); $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;'); $I->see('Edit transfer &quot;Money for piggy&quot;');
} }
@ -91,8 +95,10 @@ class TransactionControllerCest
public function show(FunctionalTester $I) public function show(FunctionalTester $I)
{ {
$journal = TransactionJournal::whereDescription('Money for new PC')->first();
$I->wantTo('see a transaction'); $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('Transfer "Money for new PC"');
$I->see('1.259'); $I->see('1.259');
} }
@ -117,27 +123,6 @@ class TransactionControllerCest
$I->see('Transaction &quot;Test&quot; stored.'); $I->see('Transaction &quot;Test&quot; stored.');
} }
public function storeAndReturn(FunctionalTester $I)
{
$I->wantTo('store a transaction');
$I->amOnPage('/transactions/create/withdrawal');
$I->submitForm(
'#store', [
'reminder' => '',
'description' => 'Test',
'account_id' => 1,
'expense_account' => 'Zomaar',
'amount' => 100,
'date' => '2014-12-30',
'budget_id' => 3,
'category' => 'Categorrr',
'post_submit_action' => 'create_another'
]
);
$I->see('Transaction &quot;Test&quot; stored.');
}
public function storeAndFail(FunctionalTester $I) public function storeAndFail(FunctionalTester $I)
{ {
$I->wantTo('store a transaction and fail'); $I->wantTo('store a transaction and fail');
@ -158,6 +143,26 @@ class TransactionControllerCest
$I->see('Could not store transaction: The description field is required.'); $I->see('Could not store transaction: The description field is required.');
} }
public function storeAndReturn(FunctionalTester $I)
{
$I->wantTo('store a transaction');
$I->amOnPage('/transactions/create/withdrawal');
$I->submitForm(
'#store', [
'reminder' => '',
'description' => 'Test',
'account_id' => 1,
'expense_account' => 'Zomaar',
'amount' => 100,
'date' => '2014-12-30',
'budget_id' => 3,
'category' => 'Categorrr',
'post_submit_action' => 'create_another'
]
);
$I->see('Transaction &quot;Test&quot; stored.');
}
public function update(FunctionalTester $I) public function update(FunctionalTester $I)
{ {
$I->wantTo('update a transaction'); $I->wantTo('update a transaction');

View File

@ -1,2 +1,8 @@
<?php <?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);
}

View File

@ -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);
}
}

View File

@ -0,0 +1,18 @@
<?php
class ExamplATest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
}
protected function tearDown()
{
}
// tests
public function testMe()
{
}
}