Fix test method names.

This commit is contained in:
James Cole
2018-09-02 20:27:26 +02:00
parent de754ca4e0
commit eaf2667abb
90 changed files with 675 additions and 676 deletions

View File

@@ -66,7 +66,7 @@ class RecurrenceFactoryTest extends TestCase
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category= $this->user()->categories()->inRandomOrder()->first();
$category = $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
@@ -160,7 +160,7 @@ class RecurrenceFactoryTest extends TestCase
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category= $this->user()->categories()->inRandomOrder()->first();
$category = $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
@@ -187,7 +187,7 @@ class RecurrenceFactoryTest extends TestCase
$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
// data for basic recurrence.
$data = [
$data = [
'recurrence' => [
'type' => 'deposit',
'first_date' => Carbon::create()->addDay(),
@@ -243,196 +243,6 @@ class RecurrenceFactoryTest extends TestCase
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* Deposit. With piggy bank. With tags. With budget. With category.
*
* @covers \FireflyIII\Factory\RecurrenceFactory
* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
*/
public function testBasicTransfer(): void
{
// objects to return:
$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category= $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
$budgetFactory = $this->mock(BudgetFactory::class);
$categoryFactory = $this->mock(CategoryFactory::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyFactory = $this->mock(TransactionCurrencyFactory::class);
// mock calls:
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
$piggyFactory->shouldReceive('setUser')->once();
$piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
$accountRepos->shouldReceive('setUser')->twice();
$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
$currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
$currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
$budgetFactory->shouldReceive('setUser')->once();
$budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
$categoryFactory->shouldReceive('setUser')->once();
$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
// data for basic recurrence.
$data = [
'recurrence' => [
'type' => 'transfer',
'first_date' => Carbon::create()->addDay(),
'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing',
'apply_rules' => true,
'active' => true,
'repeat_until' => null,
],
'meta' => [
'tags' => ['a', 'b', 'c'],
'piggy_bank_id' => 1,
'piggy_bank_name' => 'Bla bla',
],
'repetitions' => [
[
'type' => 'daily',
'moment' => '',
'skip' => 0,
'weekend' => 1,
],
],
'transactions' => [
[
'source_id' => 1,
'source_name' => 'Some name',
'destination_id' => 2,
'destination_name' => 'some otjer name',
'currency_id' => 1,
'currency_code' => 'EUR',
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_amount' => null,
'description' => 'Bla bla bla',
'amount' => '100',
'budget_id' => 1,
'budget_name' => 'Some budget',
'category_id' => 2,
'category_name' => 'Some category',
],
],
];
$typeFactory = $this->mock(TransactionTypeFactory::class);
$typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));
$factory = new RecurrenceFactory;
$factory->setUser($this->user());
$result = $factory->create($data);
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* With piggy bank. With tags. With budget. With category.
*
* @covers \FireflyIII\Factory\RecurrenceFactory
* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
*/
public function testBasicNoTags(): void
{
// objects to return:
$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category= $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
$budgetFactory = $this->mock(BudgetFactory::class);
$categoryFactory = $this->mock(CategoryFactory::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyFactory = $this->mock(TransactionCurrencyFactory::class);
// mock calls:
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
$piggyFactory->shouldReceive('setUser')->once();
$piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
$accountRepos->shouldReceive('setUser')->twice();
$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
$currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
$currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
$budgetFactory->shouldReceive('setUser')->once();
$budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
$categoryFactory->shouldReceive('setUser')->once();
$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
// data for basic recurrence.
$data = [
'recurrence' => [
'type' => 'withdrawal',
'first_date' => Carbon::create()->addDay(),
'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing',
'apply_rules' => true,
'active' => true,
'repeat_until' => null,
],
'meta' => [
'tags' => [],
'piggy_bank_id' => 1,
'piggy_bank_name' => 'Bla bla',
],
'repetitions' => [
[
'type' => 'daily',
'moment' => '',
'skip' => 0,
'weekend' => 1,
],
],
'transactions' => [
[
'source_id' => 1,
'source_name' => 'Some name',
'destination_id' => 2,
'destination_name' => 'some otjer name',
'currency_id' => 1,
'currency_code' => 'EUR',
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_amount' => null,
'description' => 'Bla bla bla',
'amount' => '100',
'budget_id' => 1,
'budget_name' => 'Some budget',
'category_id' => 2,
'category_name' => 'Some category',
],
],
];
$typeFactory = $this->mock(TransactionTypeFactory::class);
$typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));
$factory = new RecurrenceFactory;
$factory->setUser($this->user());
$result = $factory->create($data);
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* No piggy bank. With tags. With budget. With category.
*
@@ -446,7 +256,7 @@ class RecurrenceFactoryTest extends TestCase
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category= $this->user()->categories()->inRandomOrder()->first();
$category = $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
@@ -527,6 +337,196 @@ class RecurrenceFactoryTest extends TestCase
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* With piggy bank. With tags. With budget. With category.
*
* @covers \FireflyIII\Factory\RecurrenceFactory
* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
*/
public function testBasicNoTags(): void
{
// objects to return:
$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category = $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
$budgetFactory = $this->mock(BudgetFactory::class);
$categoryFactory = $this->mock(CategoryFactory::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyFactory = $this->mock(TransactionCurrencyFactory::class);
// mock calls:
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
$piggyFactory->shouldReceive('setUser')->once();
$piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
$accountRepos->shouldReceive('setUser')->twice();
$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
$currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
$currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
$budgetFactory->shouldReceive('setUser')->once();
$budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
$categoryFactory->shouldReceive('setUser')->once();
$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
// data for basic recurrence.
$data = [
'recurrence' => [
'type' => 'withdrawal',
'first_date' => Carbon::create()->addDay(),
'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing',
'apply_rules' => true,
'active' => true,
'repeat_until' => null,
],
'meta' => [
'tags' => [],
'piggy_bank_id' => 1,
'piggy_bank_name' => 'Bla bla',
],
'repetitions' => [
[
'type' => 'daily',
'moment' => '',
'skip' => 0,
'weekend' => 1,
],
],
'transactions' => [
[
'source_id' => 1,
'source_name' => 'Some name',
'destination_id' => 2,
'destination_name' => 'some otjer name',
'currency_id' => 1,
'currency_code' => 'EUR',
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_amount' => null,
'description' => 'Bla bla bla',
'amount' => '100',
'budget_id' => 1,
'budget_name' => 'Some budget',
'category_id' => 2,
'category_name' => 'Some category',
],
],
];
$typeFactory = $this->mock(TransactionTypeFactory::class);
$typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(1));
$factory = new RecurrenceFactory;
$factory->setUser($this->user());
$result = $factory->create($data);
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* Deposit. With piggy bank. With tags. With budget. With category.
*
* @covers \FireflyIII\Factory\RecurrenceFactory
* @covers \FireflyIII\Services\Internal\Support\RecurringTransactionTrait
*/
public function testBasicTransfer(): void
{
// objects to return:
$piggyBank = $this->user()->piggyBanks()->inRandomOrder()->first();
$accountA = $this->user()->accounts()->inRandomOrder()->first();
$accountB = $this->user()->accounts()->inRandomOrder()->first();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$category = $this->user()->categories()->inRandomOrder()->first();
// mock other factories:
$piggyFactory = $this->mock(PiggyBankFactory::class);
$budgetFactory = $this->mock(BudgetFactory::class);
$categoryFactory = $this->mock(CategoryFactory::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyFactory = $this->mock(TransactionCurrencyFactory::class);
// mock calls:
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn(TransactionCurrency::find(1))->once();
$piggyFactory->shouldReceive('setUser')->once();
$piggyFactory->shouldReceive('find')->withArgs([1, 'Bla bla'])->andReturn($piggyBank);
$accountRepos->shouldReceive('setUser')->twice();
$accountRepos->shouldReceive('findNull')->twice()->andReturn($accountA, $accountB);
$currencyFactory->shouldReceive('find')->once()->withArgs([1, 'EUR'])->andReturn(null);
$currencyFactory->shouldReceive('find')->once()->withArgs([null, null])->andReturn(null);
$budgetFactory->shouldReceive('setUser')->once();
$budgetFactory->shouldReceive('find')->withArgs([1, 'Some budget'])->once()->andReturn($budget);
$categoryFactory->shouldReceive('setUser')->once();
$categoryFactory->shouldReceive('findOrCreate')->withArgs([2, 'Some category'])->once()->andReturn($category);
// data for basic recurrence.
$data = [
'recurrence' => [
'type' => 'transfer',
'first_date' => Carbon::create()->addDay(),
'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing',
'apply_rules' => true,
'active' => true,
'repeat_until' => null,
],
'meta' => [
'tags' => ['a', 'b', 'c'],
'piggy_bank_id' => 1,
'piggy_bank_name' => 'Bla bla',
],
'repetitions' => [
[
'type' => 'daily',
'moment' => '',
'skip' => 0,
'weekend' => 1,
],
],
'transactions' => [
[
'source_id' => 1,
'source_name' => 'Some name',
'destination_id' => 2,
'destination_name' => 'some otjer name',
'currency_id' => 1,
'currency_code' => 'EUR',
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_amount' => null,
'description' => 'Bla bla bla',
'amount' => '100',
'budget_id' => 1,
'budget_name' => 'Some budget',
'category_id' => 2,
'category_name' => 'Some category',
],
],
];
$typeFactory = $this->mock(TransactionTypeFactory::class);
$typeFactory->shouldReceive('find')->once()->withArgs([ucfirst($data['recurrence']['type'])])->andReturn(TransactionType::find(3));
$factory = new RecurrenceFactory;
$factory->setUser($this->user());
$result = $factory->create($data);
$this->assertEquals($result->title, $data['recurrence']['title']);
}
/**
* @covers \FireflyIII\Factory\RecurrenceFactory
*/

View File

@@ -987,9 +987,9 @@ class TransactionFactoryTest extends TestCase
public function testCreatePairSameBadType(): void
{
// objects:
$expense = $this->user()->accounts()->where('account_type_id', 4)->first();
$expense = $this->user()->accounts()->where('account_type_id', 4)->first();
$revenue = $this->user()->accounts()->where('account_type_id', 5)->first();
$euro = TransactionCurrency::first();
$euro = TransactionCurrency::first();
// mocked classes
$accountRepos = $this->mock(AccountRepositoryInterface::class);

View File

@@ -163,7 +163,7 @@ class TransactionJournalFactoryTest extends TestCase
'transactions' => [
[
'amount' => '',
]
],
],
];

View File

@@ -54,7 +54,7 @@ class TransactionTypeFactoryTest extends TestCase
/** @var TransactionTypeFactory $factory */
$factory = app(TransactionTypeFactory::class);
$result = $factory->find($type->type);
$result = $factory->find($type->type);
$this->assertEquals($result->id, $type->id);
}

View File

@@ -92,27 +92,6 @@ class ChartJsGeneratorTest extends TestCase
$this->assertEquals('#123456', $result['datasets'][1]['backgroundColor']);
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
public function testPieChart(): void
{
$data = [
'one' => -1,
'two' => -2,
'three' => -3,
];
/** @var ChartJsGenerator $generator */
$generator = new ChartJsGenerator();
$result = $generator->pieChart($data);
$this->assertEquals('three', $result['labels'][0]);
$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
@@ -120,9 +99,9 @@ class ChartJsGeneratorTest extends TestCase
{
$data = [
'one' => ['amount' => -1,'currency_symbol' => 'a'],
'two' => ['amount' => -2,'currency_symbol' => 'b'],
'three' => ['amount' => -3,'currency_symbol' => 'c'],
'one' => ['amount' => -1, 'currency_symbol' => 'a'],
'two' => ['amount' => -2, 'currency_symbol' => 'b'],
'three' => ['amount' => -3, 'currency_symbol' => 'c'],
];
/** @var ChartJsGenerator $generator */
@@ -141,9 +120,9 @@ class ChartJsGeneratorTest extends TestCase
{
$data = [
'one' => ['amount' => 1,'currency_symbol' => 'a'],
'two' => ['amount' => 2,'currency_symbol' => 'b'],
'three' => ['amount' => 3,'currency_symbol' => 'c'],
'one' => ['amount' => 1, 'currency_symbol' => 'a'],
'two' => ['amount' => 2, 'currency_symbol' => 'b'],
'three' => ['amount' => 3, 'currency_symbol' => 'c'],
];
/** @var ChartJsGenerator $generator */
@@ -155,6 +134,27 @@ class ChartJsGeneratorTest extends TestCase
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
public function testPieChart(): void
{
$data = [
'one' => -1,
'two' => -2,
'three' => -3,
];
/** @var ChartJsGenerator $generator */
$generator = new ChartJsGenerator();
$result = $generator->pieChart($data);
$this->assertEquals('three', $result['labels'][0]);
$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/

View File

@@ -29,9 +29,10 @@ use FireflyIII\Handlers\Events\AdminEventHandler;
use FireflyIII\Mail\AdminTestMail;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Support\Facades\Mail;
use Log;
use Mockery;
use Tests\TestCase;
use Log;
/**
* Class AdminEventHandlerTest
*/

View File

@@ -152,8 +152,8 @@ class AttachmentHelperTest extends TestCase
// mock calls:
Storage::fake('upload');
$path = public_path('browserconfig.xml');
$helper = new AttachmentHelper;
$path = public_path('browserconfig.xml');
$helper = new AttachmentHelper;
// make new attachment:
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();

View File

@@ -34,8 +34,8 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Support\Collection;
use Tests\TestCase;
use Log;
use Tests\TestCase;
/**
* Class MetaPieChartTest

View File

@@ -66,7 +66,7 @@ class HelpTest extends TestCase
// now let's see what happens:
$help = new Help;
$result = $help->getFromGitHub('test-route', 'en_US');
$this->assertEquals('<p>Some help text.</p>'."\n", $result);
$this->assertEquals('<p>Some help text.</p>' . "\n", $result);
}
/**

View File

@@ -33,6 +33,20 @@ use Tests\TestCase;
*/
class AuthenticateTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware('auth')->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\Authenticate
*/
@@ -98,18 +112,4 @@ class AuthenticateTest extends TestCase
$response->assertSessionHas('logoutMessage', (string)trans('firefly.email_changed_logout'));
$response->assertRedirect(route('login'));
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware('auth')->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
}

View File

@@ -35,6 +35,20 @@ use Tests\TestCase;
*/
class AuthenticateTwoFactorTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(AuthenticateTwoFactor::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor
*/
@@ -174,18 +188,4 @@ class AuthenticateTwoFactorTest extends TestCase
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
$response->assertRedirect(route('two-factor.index'));
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(AuthenticateTwoFactor::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
}

View File

@@ -33,6 +33,20 @@ use Tests\TestCase;
*/
class IsAdminTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(IsAdmin::class)->any(
'/_test/is-admin', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\IsAdmin
*/
@@ -77,18 +91,4 @@ class IsAdminTest extends TestCase
$response = $this->get('/_test/is-admin');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(IsAdmin::class)->any(
'/_test/is-admin', function () {
return 'OK';
}
);
}
}

View File

@@ -34,6 +34,20 @@ use Tests\TestCase;
*/
class IsDemoUserTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware([StartFireflySession::class, IsDemoUser::class])->any(
'/_test/is-demo', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\IsDemoUser
*/
@@ -63,18 +77,4 @@ class IsDemoUserTest extends TestCase
$response = $this->get('/_test/is-demo');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware([StartFireflySession::class, IsDemoUser::class])->any(
'/_test/is-demo', function () {
return 'OK';
}
);
}
}

View File

@@ -33,6 +33,20 @@ use Tests\TestCase;
*/
class IsSandstormUserTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(IsSandStormUser::class)->any(
'/_test/is-sandstorm', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\IsSandStormUser
*/
@@ -69,18 +83,4 @@ class IsSandstormUserTest extends TestCase
$response->assertRedirect(route('index'));
putenv('SANDSTORM=0');
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(IsSandStormUser::class)->any(
'/_test/is-sandstorm', function () {
return 'OK';
}
);
}
}

View File

@@ -35,6 +35,20 @@ use Tests\TestCase;
*/
class RangeTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(Range::class)->any(
'/_test/range', function () {
return view('test.test');
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\Range
*/
@@ -62,18 +76,4 @@ class RangeTest extends TestCase
$response = $this->get('/_test/range');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(Range::class)->any(
'/_test/range', function () {
return view('test.test');
}
);
}
}

View File

@@ -35,6 +35,20 @@ use Tests\TestCase;
*/
class RedirectIf2FAAuthenticatedTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(RedirectIfTwoFactorAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\RedirectIfTwoFactorAuthenticated
*/
@@ -77,18 +91,4 @@ class RedirectIf2FAAuthenticatedTest extends TestCase
$response = $this->get('/_test/authenticate');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(RedirectIfTwoFactorAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
}

View File

@@ -33,6 +33,20 @@ use Tests\TestCase;
*/
class RedirectIfAuthenticatedTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(RedirectIfAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\RedirectIfAuthenticated
*/
@@ -52,18 +66,4 @@ class RedirectIfAuthenticatedTest extends TestCase
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
$response->assertRedirect(route('index'));
}
/**
* Set up test
*/
protected function setUp()
{
parent::setUp();
Route::middleware(RedirectIfAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';
}
);
}
}

View File

@@ -35,6 +35,20 @@ use Tests\TestCase;
*/
class SandstormTest extends TestCase
{
/**
* Set up test
*/
public function setUp(): void
{
parent::setUp();
Route::middleware(Sandstorm::class)->any(
'/_test/sandstorm', function () {
return view('test.test');
}
);
}
/**
* @covers \FireflyIII\Http\Middleware\Sandstorm
*/
@@ -56,18 +70,4 @@ class SandstormTest extends TestCase
putenv('SANDSTORM=0');
}
/**
* Set up test
*/
protected function setUp(): void
{
parent::setUp();
Route::middleware(Sandstorm::class)->any(
'/_test/sandstorm', function () {
return view('test.test');
}
);
}
}

View File

@@ -193,7 +193,7 @@ class ChooseAccountsHandlerTest extends TestCase
];
$expected = $config;
$expected['mapping'][0] = 456;
$expected['bunq-iban'] = [];
$expected['bunq-iban'] = [];
// mock stuff
$repository = $this->mock(ImportJobRepositoryInterface::class);

View File

@@ -22,7 +22,6 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\CategoryIs;
use Tests\TestCase;
@@ -69,7 +68,7 @@ class CategoryIsTest extends TestCase
*/
public function testTriggeredTransaction(): void
{
$withdrawal = $this->getRandomWithdrawal();
$withdrawal = $this->getRandomWithdrawal();
$transaction = $withdrawal->transactions()->first();
$category = $withdrawal->user->categories()->first();

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\HasAnyBudget;
use Log;
use Tests\TestCase;

View File

@@ -22,7 +22,6 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\HasAttachment;
use Tests\TestCase;

View File

@@ -75,7 +75,7 @@ class HasNoCategoryTest extends TestCase
*/
public function testTriggeredTransaction(): void
{
$withdrawal = $this->getRandomWithdrawal();
$withdrawal = $this->getRandomWithdrawal();
$transaction = $withdrawal->transactions()->first();
$category = $withdrawal->user->categories()->first();