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
{
/**
* 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;
/** @var User */
private $user;

View File

@@ -34,7 +34,15 @@ use Log;
*/
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
*

View File

@@ -26,12 +26,22 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note;
use FireflyIII\User;
use Log;
/**
* 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 */
private $user;

View File

@@ -36,6 +36,16 @@ use Log;
*/
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;
/** @var User */
private $user;

View File

@@ -27,12 +27,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Budget;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
* 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 */
private $user;

View File

@@ -34,6 +34,16 @@ use Log;
*/
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 */
private $user;

View File

@@ -37,6 +37,16 @@ use Log;
*/
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 PiggyBank|null $piggyBank

View File

@@ -26,12 +26,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\PiggyBank;
use FireflyIII\User;
use Log;
/**
* 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 */
private $user;

View File

@@ -39,6 +39,16 @@ use Log;
*/
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;
/** @var User */

View File

@@ -27,12 +27,23 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Tag;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
* 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 */
private $tags;
/** @var User */

View File

@@ -36,6 +36,16 @@ use Log;
*/
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
*

View File

@@ -40,6 +40,16 @@ use Log;
*/
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;
/** @var User */

View File

@@ -36,6 +36,16 @@ use Log;
*/
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;
/** @var User The user */
private $user;

View File

@@ -34,6 +34,16 @@ use Log;
*/
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
*

View File

@@ -26,12 +26,22 @@ declare(strict_types=1);
namespace FireflyIII\Factory;
use FireflyIII\Models\TransactionType;
use Log;
/**
* 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
*