mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New tests and new configuration for tests.
This commit is contained in:
parent
8e892e7ea5
commit
584f7ced84
2
app/config/testingInMemory/app.php
Normal file
2
app/config/testingInMemory/app.php
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
return ['log_level' => 'debug',];
|
8
app/config/testingInMemory/auth.php
Normal file
8
app/config/testingInMemory/auth.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'verify_mail' => false,
|
||||||
|
'verify_reset' => true,
|
||||||
|
'allow_register' => true
|
||||||
|
|
||||||
|
];
|
3
app/config/testingInMemory/cache.php
Normal file
3
app/config/testingInMemory/cache.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return ['driver' => 'array',];
|
12
app/config/testingInMemory/database.php
Normal file
12
app/config/testingInMemory/database.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'default' => 'sqlite',
|
||||||
|
'connections' => [
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'database' => ':memory:',
|
||||||
|
'prefix' => ''
|
||||||
|
]
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
13
app/config/testingInMemory/mail.php
Normal file
13
app/config/testingInMemory/mail.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'driver' => 'smtp',
|
||||||
|
'host' => '',
|
||||||
|
'port' => 587,
|
||||||
|
'from' => ['address' => '', 'name' => 'Firefly III'],
|
||||||
|
'encryption' => 'tls',
|
||||||
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
|
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||||
|
'pretend' => true,
|
||||||
|
];
|
3
app/config/testingInMemory/session.php
Normal file
3
app/config/testingInMemory/session.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return ['driver' => 'array',];
|
@ -16,7 +16,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
public function createApplication()
|
public function createApplication()
|
||||||
{
|
{
|
||||||
$unitTesting = true;
|
$unitTesting = true;
|
||||||
$testEnvironment = 'testing';
|
$testEnvironment = 'testingInMemory';
|
||||||
|
|
||||||
|
|
||||||
return require __DIR__ . '/../../bootstrap/start.php';
|
return require __DIR__ . '/../../bootstrap/start.php';
|
||||||
|
|
||||||
@ -25,6 +26,9 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
// reset database?
|
||||||
|
$this->prepareForTests();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function setupBeforeClass()
|
static public function setupBeforeClass()
|
||||||
@ -37,4 +41,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
{
|
{
|
||||||
//m::close();
|
//m::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrates the database and set the mailer to 'pretend'.
|
||||||
|
* This will cause the tests to run quickly.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private function prepareForTests()
|
||||||
|
{
|
||||||
|
Artisan::call('migrate');
|
||||||
|
Mail::pretend(true);
|
||||||
|
}
|
||||||
}
|
}
|
8
app/tests/factories/Budget.php
Normal file
8
app/tests/factories/Budget.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
League\FactoryMuffin\Facade::define(
|
||||||
|
'Budget', [
|
||||||
|
'name' => 'word',
|
||||||
|
'user_id' => 'factory|User'
|
||||||
|
]
|
||||||
|
);
|
27
tests/unit/AccountTypeTest.php
Normal file
27
tests/unit/AccountTypeTest.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
use League\FactoryMuffin\Facade as f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AccountTypeTest
|
||||||
|
*/
|
||||||
|
class AccountTypeTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
// tests
|
||||||
|
public function testAccounts()
|
||||||
|
{
|
||||||
|
$account = f::create('Account');
|
||||||
|
$this->assertCount(1, $account->accountType()->first()->accounts()->get());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
tests/unit/BudgetTest.php
Normal file
26
tests/unit/BudgetTest.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
use League\FactoryMuffin\Facade as f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AccountTypeTest
|
||||||
|
*/
|
||||||
|
class BudgetTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUser()
|
||||||
|
{
|
||||||
|
$budget = f::create('Budget');
|
||||||
|
$this->assertInstanceOf('User', $budget->user);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ExamplATest extends \PHPUnit_Framework_TestCase
|
|
||||||
{
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// tests
|
|
||||||
public function testMe()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user