mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
New tests and factories.
This commit is contained in:
parent
64c031c7fe
commit
6a9ffae25d
@ -34,7 +34,9 @@
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"phpspec/phpspec": "~2.1",
|
||||
"satooshi/php-coveralls": "0.6.1",
|
||||
"mockery/mockery": "0.9.*"
|
||||
"mockery/mockery": "0.9.*",
|
||||
"league/factory-muffin": "~2.1"
|
||||
|
||||
|
||||
},
|
||||
"autoload": {
|
||||
|
121
composer.lock
generated
121
composer.lock
generated
@ -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": "ef4d2cfd4c5768b32c52a1738045d66c",
|
||||
"hash": "0d43c4c85607c5cdc901cde2d18b75d5",
|
||||
"packages": [
|
||||
{
|
||||
"name": "classpreloader/classpreloader",
|
||||
@ -945,16 +945,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.0.25",
|
||||
"version": "v5.0.26",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "c6f290f3ccbff16749a50f125c407ae7a492ad32"
|
||||
"reference": "8e53c33e144f94032cc6ecbfee0be2a96ed63be0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/c6f290f3ccbff16749a50f125c407ae7a492ad32",
|
||||
"reference": "c6f290f3ccbff16749a50f125c407ae7a492ad32",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/8e53c33e144f94032cc6ecbfee0be2a96ed63be0",
|
||||
"reference": "8e53c33e144f94032cc6ecbfee0be2a96ed63be0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1067,7 +1067,7 @@
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2015-04-02 18:42:46"
|
||||
"time": "2015-04-03 02:58:05"
|
||||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
@ -2572,6 +2572,54 @@
|
||||
],
|
||||
"time": "2014-10-13 12:58:55"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
"version": "v1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fzaninotto/Faker.git",
|
||||
"reference": "010c7efedd88bf31141a02719f51fb44c732d5a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/010c7efedd88bf31141a02719f51fb44c732d5a0",
|
||||
"reference": "010c7efedd88bf31141a02719f51fb44c732d5a0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "~1.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": []
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Faker": "src/",
|
||||
"Faker\\PHPUnit": "test/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "François Zaninotto"
|
||||
}
|
||||
],
|
||||
"description": "Faker is a PHP library that generates fake data for you.",
|
||||
"keywords": [
|
||||
"data",
|
||||
"faker",
|
||||
"fixtures"
|
||||
],
|
||||
"time": "2014-06-04 14:43:02"
|
||||
},
|
||||
{
|
||||
"name": "guzzle/guzzle",
|
||||
"version": "v3.9.3",
|
||||
@ -2712,6 +2760,67 @@
|
||||
],
|
||||
"time": "2015-01-20 19:34:09"
|
||||
},
|
||||
{
|
||||
"name": "league/factory-muffin",
|
||||
"version": "v2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/factory-muffin.git",
|
||||
"reference": "91f0adcdac6b5f7bf2277ac2c90f94352afe65de"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/factory-muffin/zipball/91f0adcdac6b5f7bf2277ac2c90f94352afe65de",
|
||||
"reference": "91f0adcdac6b5f7bf2277ac2c90f94352afe65de",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"fzaninotto/faker": "1.4.*",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"replace": {
|
||||
"zizaco/factory-muff": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "~4.1",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/database": "Factory Muffin works well with eloquent models."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"League\\FactoryMuffin\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "graham@mineuk.com"
|
||||
},
|
||||
{
|
||||
"name": "Zizaco Zizuini",
|
||||
"email": "zizaco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Scott Robertson",
|
||||
"email": "scottymeuk@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "The goal of this package is to enable the rapid creation of objects for the purpose of testing.",
|
||||
"homepage": "http://factory-muffin.thephpleague.com/",
|
||||
"keywords": [
|
||||
"factory",
|
||||
"laravel",
|
||||
"testing"
|
||||
],
|
||||
"time": "2014-09-18 18:29:06"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
"version": "v1.10.4",
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2015-03-08 at 20:05:14.
|
||||
*/
|
||||
@ -15,7 +17,6 @@ class AccountControllerTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -31,10 +32,10 @@ class AccountControllerTest extends TestCase
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be(new FireflyIII\User);
|
||||
|
||||
$pref = new Preference;
|
||||
$pref = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$pref->data = '1M';
|
||||
$this->be($pref->user);
|
||||
|
||||
|
||||
// CURRENCY:
|
||||
$currency = new TransactionCurrency;
|
||||
@ -42,9 +43,8 @@ class AccountControllerTest extends TestCase
|
||||
Preferences::shouldReceive('get', 'viewRange')->andReturn($pref);
|
||||
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
|
||||
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
|
||||
// get all currencires?
|
||||
|
||||
$response = $this->call('GET', '/accounts/create/asset');
|
||||
$this->call('GET', '/accounts/create/asset');
|
||||
$this->assertResponseOk();
|
||||
|
||||
|
||||
@ -56,7 +56,16 @@ class AccountControllerTest extends TestCase
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
// fake an account.
|
||||
$account = FactoryMuffin::create('FireflyIII\Models\Account');
|
||||
$account->accountType->type = 'Asset account';
|
||||
$account->accountType->save();
|
||||
|
||||
$this->be($account->user);
|
||||
$this->call('GET', '/accounts/delete/' . $account->id);
|
||||
$this->assertResponseOk();
|
||||
$this->assertViewHas('subTitle', 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"');
|
||||
|
||||
}
|
||||
|
||||
public function testDestroy()
|
||||
|
35
tests/factories/all.php
Normal file
35
tests/factories/all.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
FactoryMuffin::define(
|
||||
'FireflyIII\Models\Account', [
|
||||
'user_id' => 'factory|FireflyIII\User',
|
||||
'account_type_id' => 'factory|FireflyIII\Models\AccountType',
|
||||
'name' => 'word',
|
||||
'active' => 'boolean',
|
||||
'encrypted' => 'boolean',
|
||||
'virtual_balance' => 0
|
||||
]
|
||||
);
|
||||
|
||||
FactoryMuffin::define(
|
||||
'FireflyIII\Models\Preference', [
|
||||
'name' => 'word',
|
||||
'data' => 'sentence',
|
||||
'user_id' => 'factory|FireflyIII\User',
|
||||
]
|
||||
);
|
||||
|
||||
FactoryMuffin::define(
|
||||
'FireflyIII\Models\AccountType', [
|
||||
'type' => 'word',
|
||||
'editable' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
FactoryMuffin::define(
|
||||
'FireflyIII\User', [
|
||||
'email' => 'email',
|
||||
'password' => bcrypt('james'),
|
||||
]
|
||||
);
|
Loading…
Reference in New Issue
Block a user