Warn when classes are used in testing environment; this means tests aren't efficient.

This commit is contained in:
James Cole
2018-09-06 12:29:32 +02:00
parent 013c8707ac
commit 03956af88a
44 changed files with 410 additions and 22 deletions

View File

@@ -41,6 +41,16 @@ use Log;
*/ */
class AccountFactory class AccountFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
use AccountServiceTrait; use AccountServiceTrait;
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -34,7 +34,15 @@ use Log;
*/ */
class AccountMetaFactory class AccountMetaFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param array $data * @param array $data
* *

View File

@@ -26,12 +26,22 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note; use FireflyIII\Models\Note;
use FireflyIII\User; use FireflyIII\User;
use Log;
/** /**
* Class AttachmentFactory * Class AttachmentFactory
*/ */
class AttachmentFactory class AttachmentFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -36,6 +36,16 @@ use Log;
*/ */
class BillFactory class BillFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
use BillServiceTrait; use BillServiceTrait;
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -27,12 +27,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class BudgetFactory. * Class BudgetFactory.
*/ */
class BudgetFactory class BudgetFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -34,6 +34,16 @@ use Log;
*/ */
class CategoryFactory class CategoryFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -37,6 +37,16 @@ use Log;
*/ */
class PiggyBankEventFactory class PiggyBankEventFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param TransactionJournal $journal * @param TransactionJournal $journal
* @param PiggyBank|null $piggyBank * @param PiggyBank|null $piggyBank

View File

@@ -26,12 +26,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\User; use FireflyIII\User;
use Log;
/** /**
* Class PiggyBankFactory * Class PiggyBankFactory
*/ */
class PiggyBankFactory class PiggyBankFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -39,6 +39,16 @@ use Log;
*/ */
class RecurrenceFactory class RecurrenceFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait; use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait;
/** @var User */ /** @var User */

View File

@@ -27,12 +27,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Tag; use FireflyIII\Models\Tag;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class TagFactory * Class TagFactory
*/ */
class TagFactory class TagFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var Collection */ /** @var Collection */
private $tags; private $tags;
/** @var User */ /** @var User */

View File

@@ -36,6 +36,16 @@ use Log;
*/ */
class TransactionCurrencyFactory class TransactionCurrencyFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param array $data * @param array $data
* *

View File

@@ -40,6 +40,16 @@ use Log;
*/ */
class TransactionFactory class TransactionFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
use TransactionServiceTrait; use TransactionServiceTrait;
/** @var User */ /** @var User */

View File

@@ -36,6 +36,16 @@ use Log;
*/ */
class TransactionJournalFactory class TransactionJournalFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
use JournalServiceTrait, TransactionTypeTrait; use JournalServiceTrait, TransactionTypeTrait;
/** @var User The user */ /** @var User The user */
private $user; private $user;

View File

@@ -34,6 +34,16 @@ use Log;
*/ */
class TransactionJournalMetaFactory class TransactionJournalMetaFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param array $data * @param array $data
* *

View File

@@ -26,12 +26,22 @@ declare(strict_types=1);
namespace FireflyIII\Factory; namespace FireflyIII\Factory;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Log;
/** /**
* Class TransactionTypeFactory * Class TransactionTypeFactory
*/ */
class TransactionTypeFactory class TransactionTypeFactory
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param string $type * @param string $type
* *

View File

@@ -23,12 +23,22 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Chart\Basic; namespace FireflyIII\Generator\Chart\Basic;
use FireflyIII\Support\ChartColour; use FireflyIII\Support\ChartColour;
use Log;
/** /**
* Class ChartJsGenerator. * Class ChartJsGenerator.
*/ */
class ChartJsGenerator implements GeneratorInterface class ChartJsGenerator implements GeneratorInterface
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Will generate a Chart JS compatible array from the given input. Expects this format. * Will generate a Chart JS compatible array from the given input. Expects this format.
* *

View File

@@ -63,7 +63,12 @@ class AttachmentHelper implements AttachmentHelperInterface
$this->messages = new MessageBag; $this->messages = new MessageBag;
$this->attachments = new Collection; $this->attachments = new Collection;
$this->uploadDisk = Storage::disk('upload'); $this->uploadDisk = Storage::disk('upload');
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
} }
}
/** /**
* Returns the content of an attachment. * Returns the content of an attachment.

View File

@@ -38,6 +38,7 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class MetaPieChart. * Class MetaPieChart.
@@ -88,6 +89,11 @@ class MetaPieChart implements MetaPieChartInterface
$this->budgets = new Collection; $this->budgets = new Collection;
$this->categories = new Collection; $this->categories = new Collection;
$this->tags = new Collection; $this->tags = new Collection;
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -57,6 +57,16 @@ use Log;
*/ */
class TransactionCollector implements TransactionCollectorInterface class TransactionCollector implements TransactionCollectorInterface
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var array */ /** @var array */
private $accountIds = []; private $accountIds = [];

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Helpers; namespace FireflyIII\Helpers;
use Carbon\Carbon; use Carbon\Carbon;
use Log;
/** /**
* Class FiscalHelper. * Class FiscalHelper.
@@ -38,6 +39,10 @@ class FiscalHelper implements FiscalHelperInterface
public function __construct() public function __construct()
{ {
$this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data; $this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data;
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -40,6 +40,16 @@ class Help implements HelpInterface
/** @var string The user agent. */ /** @var string The user agent. */
protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'; protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Get from cache. * Get from cache.
* *

View File

@@ -51,6 +51,11 @@ class BalanceReportHelper implements BalanceReportHelperInterface
public function __construct(BudgetRepositoryInterface $budgetRepository) public function __construct(BudgetRepositoryInterface $budgetRepository)
{ {
$this->budgetRepository = $budgetRepository; $this->budgetRepository = $budgetRepository;
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -27,6 +27,7 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class BudgetReportHelper. * Class BudgetReportHelper.
@@ -46,6 +47,11 @@ class BudgetReportHelper implements BudgetReportHelperInterface
public function __construct(BudgetRepositoryInterface $repository) public function __construct(BudgetRepositoryInterface $repository)
{ {
$this->repository = $repository; $this->repository = $repository;
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -48,6 +48,16 @@ class NetWorth implements NetWorthInterface
/** @var User */ /** @var User */
private $user; private $user;
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Returns the user's net worth in an array with the following layout: * Returns the user's net worth in an array with the following layout:
* *

View File

@@ -30,7 +30,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class PopupReport. * Class PopupReport.
* *
@@ -38,6 +38,16 @@ use Illuminate\Support\Collection;
*/ */
class PopupReport implements PopupReportInterface class PopupReport implements PopupReportInterface
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Collect the tranactions for one account and one budget. * Collect the tranactions for one account and one budget.
* *

View File

@@ -32,7 +32,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
/** /**
* Class ReportHelper. * Class ReportHelper.
* *
@@ -52,6 +52,12 @@ class ReportHelper implements ReportHelperInterface
public function __construct(BudgetRepositoryInterface $budgetRepository) public function __construct(BudgetRepositoryInterface $budgetRepository)
{ {
$this->budgetRepository = $budgetRepository; $this->budgetRepository = $budgetRepository;
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -64,8 +64,8 @@ class LinkController extends Controller
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
if (true !== session('link_types.create.fromStore')) { if (true !== session('link-types.create.fromStore')) {
$this->rememberPreviousUri('link_types.create.uri'); $this->rememberPreviousUri('link-types.create.uri');
} }
return view('admin.link.create', compact('subTitle', 'subTitleIcon')); return view('admin.link.create', compact('subTitle', 'subTitleIcon'));
@@ -100,7 +100,7 @@ class LinkController extends Controller
} }
} }
// put previous url in session // put previous url in session
$this->rememberPreviousUri('link_types.delete.uri'); $this->rememberPreviousUri('link-types.delete.uri');
return view('admin.link.delete', compact('linkType', 'subTitle', 'moveTo', 'count')); return view('admin.link.delete', compact('linkType', 'subTitle', 'moveTo', 'count'));
} }
@@ -123,7 +123,7 @@ class LinkController extends Controller
$request->session()->flash('success', (string)trans('firefly.deleted_link_type', ['name' => $name])); $request->session()->flash('success', (string)trans('firefly.deleted_link_type', ['name' => $name]));
app('preferences')->mark(); app('preferences')->mark();
return redirect($this->getPreviousUri('link_types.delete.uri')); return redirect($this->getPreviousUri('link-types.delete.uri'));
} }
/** /**
@@ -145,10 +145,10 @@ class LinkController extends Controller
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('link_types.edit.fromUpdate')) { if (true !== session('link-types.edit.fromUpdate')) {
$this->rememberPreviousUri('link_types.edit.uri'); // @codeCoverageIgnore $this->rememberPreviousUri('link-types.edit.uri'); // @codeCoverageIgnore
} }
$request->session()->forget('link_types.edit.fromUpdate'); $request->session()->forget('link-types.edit.fromUpdate');
return view('admin.link.edit', compact('subTitle', 'subTitleIcon', 'linkType')); return view('admin.link.edit', compact('subTitle', 'subTitleIcon', 'linkType'));
} }
@@ -207,10 +207,10 @@ class LinkController extends Controller
]; ];
$linkType = $repository->store($data); $linkType = $repository->store($data);
$request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name])); $request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
$redirect = redirect($this->getPreviousUri('link_types.create.uri')); $redirect = redirect($this->getPreviousUri('link-types.create.uri'));
if (1 === (int)$request->get('create_another')) { if (1 === (int)$request->get('create_another')) {
// set value so create routine will not overwrite URL: // set value so create routine will not overwrite URL:
$request->session()->put('link_types.create.fromStore', true); $request->session()->put('link-types.create.fromStore', true);
$redirect = redirect(route('admin.links.create'))->withInput(); $redirect = redirect(route('admin.links.create'))->withInput();
} }
@@ -245,10 +245,10 @@ class LinkController extends Controller
$request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name])); $request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));
app('preferences')->mark(); app('preferences')->mark();
$redirect = redirect($this->getPreviousUri('link_types.edit.uri')); $redirect = redirect($this->getPreviousUri('link-types.edit.uri'));
if (1 === (int)$request->get('return_to_edit')) { if (1 === (int)$request->get('return_to_edit')) {
// set value so edit routine will not overwrite URL: // set value so edit routine will not overwrite URL:
$request->session()->put('link_types.edit.fromUpdate', true); $request->session()->put('link-types.edit.fromUpdate', true);
$redirect = redirect(route('admin.links.edit', [$linkType->id]))->withInput(['return_to_edit' => 1]); $redirect = redirect(route('admin.links.edit', [$linkType->id]))->withInput(['return_to_edit' => 1]);
} }

View File

@@ -34,6 +34,16 @@ use RuntimeException;
*/ */
class IpifyOrg implements IPRetrievalInterface class IpifyOrg implements IPRetrievalInterface
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Returns the user's IP address. * Returns the user's IP address.
* *

View File

@@ -37,6 +37,16 @@ use Log;
*/ */
class AccountDestroyService class AccountDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param Account $account * @param Account $account
* @param Account|null $moveTo * @param Account|null $moveTo

View File

@@ -33,6 +33,16 @@ use Log;
*/ */
class BillDestroyService class BillDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param Bill $bill * @param Bill $bill
*/ */

View File

@@ -32,6 +32,16 @@ use Log;
*/ */
class CategoryDestroyService class CategoryDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param Category $category * @param Category $category
*/ */

View File

@@ -32,6 +32,16 @@ use Log;
*/ */
class CurrencyDestroyService class CurrencyDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
*/ */

View File

@@ -35,6 +35,16 @@ use Log;
*/ */
class JournalDestroyService class JournalDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param TransactionJournal $journal * @param TransactionJournal $journal
*/ */

View File

@@ -34,6 +34,16 @@ use Log;
*/ */
class RecurrenceDestroyService class RecurrenceDestroyService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Delete recurrence. * Delete recurrence.
* *

View File

@@ -33,6 +33,16 @@ use Log;
*/ */
class EncryptService class EncryptService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param string $file * @param string $file
* @param string $key * @param string $key

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Services\Internal\Support\AccountServiceTrait; use FireflyIII\Services\Internal\Support\AccountServiceTrait;
use Log;
/** /**
* Class AccountUpdateService * Class AccountUpdateService
@@ -32,7 +33,15 @@ use FireflyIII\Services\Internal\Support\AccountServiceTrait;
class AccountUpdateService class AccountUpdateService
{ {
use AccountServiceTrait; use AccountServiceTrait;
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Update account data. * Update account data.

View File

@@ -25,7 +25,7 @@ namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Services\Internal\Support\BillServiceTrait; use FireflyIII\Services\Internal\Support\BillServiceTrait;
use Log;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* Class BillUpdateService * Class BillUpdateService
@@ -34,6 +34,16 @@ class BillUpdateService
{ {
use BillServiceTrait; use BillServiceTrait;
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param Bill $bill * @param Bill $bill
* @param array $data * @param array $data

View File

@@ -24,13 +24,23 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Update; namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use Log;
/** /**
* Class CategoryUpdateService * Class CategoryUpdateService
*/ */
class CategoryUpdateService class CategoryUpdateService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param Category $category * @param Category $category
* @param array $data * @param array $data

View File

@@ -24,12 +24,22 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Update; namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use Log;
/** /**
* Class CurrencyUpdateService * Class CurrencyUpdateService
*/ */
class CurrencyUpdateService class CurrencyUpdateService
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
* @param array $data * @param array $data

View File

@@ -30,7 +30,6 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Services\Internal\Support\JournalServiceTrait; use FireflyIII\Services\Internal\Support\JournalServiceTrait;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
/** /**
* Class to centralise code that updates a journal given the input by system. * Class to centralise code that updates a journal given the input by system.
* *
@@ -39,6 +38,16 @@ use Log;
class JournalUpdateService class JournalUpdateService
{ {
use JournalServiceTrait; use JournalServiceTrait;
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* @param TransactionJournal $journal * @param TransactionJournal $journal

View File

@@ -26,7 +26,7 @@ namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Services\Internal\Support\TransactionServiceTrait; use FireflyIII\Services\Internal\Support\TransactionServiceTrait;
use FireflyIII\User; use FireflyIII\User;
use Log;
/** /**
* Class TransactionUpdateService * Class TransactionUpdateService
*/ */
@@ -34,6 +34,16 @@ class TransactionUpdateService
{ {
use TransactionServiceTrait; use TransactionServiceTrait;
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** @var User */ /** @var User */
private $user; private $user;

View File

@@ -33,6 +33,16 @@ use RuntimeException;
*/ */
class PwndVerifierV2 implements Verifier class PwndVerifierV2 implements Verifier
{ {
/**
* Constructor.
*/
public function __construct()
{
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
}
/** /**
* Verify the given password against (some) service. * Verify the given password against (some) service.
* *

View File

@@ -55,6 +55,11 @@ class Search implements SearchInterface
{ {
$this->modifiers = new Collection; $this->modifiers = new Collection;
$this->validModifiers = (array)config('firefly.search_modifiers'); $this->validModifiers = (array)config('firefly.search_modifiers');
if ('testing' === env('APP_ENV')) {
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
}
} }
/** /**

View File

@@ -89,6 +89,7 @@ class ExportControllerTest extends TestCase
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->atLeast()->once()->andReturn(false); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->atLeast()->once()->andReturn(false);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('exists')->andReturn(false);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('export.download', ['testExport'])); $response = $this->get(route('export.download', ['testExport']));