Remove a lot of deprecated code.

This commit is contained in:
James Cole
2018-07-25 06:45:25 +02:00
parent dbf019135a
commit 7c950c3022
39 changed files with 189 additions and 621 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountContains;
use Tests\TestCase;
@@ -36,6 +37,7 @@ class FromAccountContainsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
@@ -54,6 +56,7 @@ class FromAccountContainsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$trigger = FromAccountContains::makeFromStrings('some name' . random_int(1, 234), false);
@@ -66,6 +69,7 @@ class FromAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = FromAccountContains::willMatchEverything($value);
$this->assertTrue($result);
@@ -76,6 +80,7 @@ class FromAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = FromAccountContains::willMatchEverything($value);
$this->assertFalse($result);
@@ -86,6 +91,7 @@ class FromAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = FromAccountContains::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountEnds;
use Tests\TestCase;
@@ -36,6 +37,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
@@ -54,6 +56,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
@@ -72,6 +75,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$trigger = FromAccountEnds::makeFromStrings('some name' . random_int(1, 234), false);
@@ -84,6 +88,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = FromAccountEnds::willMatchEverything($value);
$this->assertTrue($result);
@@ -94,6 +99,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = FromAccountEnds::willMatchEverything($value);
$this->assertFalse($result);
@@ -104,6 +110,7 @@ class FromAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = FromAccountEnds::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountIs;
use Tests\TestCase;
use Log;
@@ -36,6 +37,7 @@ class FromAccountIsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
@@ -62,6 +64,7 @@ class FromAccountIsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$trigger = FromAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
@@ -74,6 +77,7 @@ class FromAccountIsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = FromAccountIs::willMatchEverything($value);
$this->assertTrue($result);
@@ -84,6 +88,7 @@ class FromAccountIsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = FromAccountIs::willMatchEverything($value);
$this->assertFalse($result);
@@ -94,6 +99,7 @@ class FromAccountIsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = FromAccountIs::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountStarts;
use Log;
use Tests\TestCase;
@@ -46,6 +47,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('In testTriggered()');
$loops = 0; // FINAL LOOP METHOD.
do {
@@ -77,6 +79,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('In testTriggeredLonger()');
$loops = 0; // FINAL LOOP METHOD.
do {
@@ -108,6 +111,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$trigger = FromAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
@@ -120,6 +124,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = FromAccountStarts::willMatchEverything($value);
$this->assertTrue($result);
@@ -130,6 +135,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = FromAccountStarts::willMatchEverything($value);
$this->assertFalse($result);
@@ -140,6 +146,7 @@ class FromAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = FromAccountStarts::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountContains;
use Tests\TestCase;
@@ -36,6 +37,8 @@ class ToAccountContainsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
@@ -56,6 +59,7 @@ class ToAccountContainsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
@@ -76,6 +80,7 @@ class ToAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = ToAccountContains::willMatchEverything($value);
$this->assertTrue($result);
@@ -86,6 +91,7 @@ class ToAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = ToAccountContains::willMatchEverything($value);
$this->assertFalse($result);
@@ -96,6 +102,7 @@ class ToAccountContainsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = ToAccountContains::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountEnds;
use Log;
use Tests\TestCase;
@@ -37,7 +38,8 @@ class ToAccountEndsTest extends TestCase
*/
public function testTriggered(): void
{
$loops = 0; // FINAL LOOP METHOD.
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
@@ -68,7 +70,8 @@ class ToAccountEndsTest extends TestCase
*/
public function testTriggeredLonger(): void
{
$loops = 0; // FINAL LOOP METHOD.
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
@@ -98,7 +101,8 @@ class ToAccountEndsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$loops = 0; // FINAL LOOP METHOD.
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
@@ -128,8 +132,9 @@ class ToAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$value = '';
$result = ToAccountEnds::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = ToAccountEnds::willMatchEverything($value);
$this->assertTrue($result);
}
@@ -138,8 +143,9 @@ class ToAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$value = 'x';
$result = ToAccountEnds::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = ToAccountEnds::willMatchEverything($value);
$this->assertFalse($result);
}
@@ -148,8 +154,9 @@ class ToAccountEndsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$value = null;
$result = ToAccountEnds::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = ToAccountEnds::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountIs;
use Tests\TestCase;
use Log;
@@ -37,6 +38,7 @@ class ToAccountIsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
@@ -64,6 +66,7 @@ class ToAccountIsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
@@ -89,6 +92,7 @@ class ToAccountIsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = ToAccountIs::willMatchEverything($value);
$this->assertTrue($result);
@@ -99,6 +103,7 @@ class ToAccountIsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = ToAccountIs::willMatchEverything($value);
$this->assertFalse($result);
@@ -109,6 +114,7 @@ class ToAccountIsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = ToAccountIs::willMatchEverything($value);
$this->assertTrue($result);

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountStarts;
use Log;
use Tests\TestCase;
@@ -37,6 +38,7 @@ class ToAccountStartsTest extends TestCase
*/
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('Now in testTriggered');
$loops = 0; // FINAL LOOP METHOD.
@@ -65,6 +67,7 @@ class ToAccountStartsTest extends TestCase
*/
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('Now in testTriggeredLonger');
@@ -93,7 +96,8 @@ class ToAccountStartsTest extends TestCase
*/
public function testTriggeredNot(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$trigger = ToAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);
@@ -105,8 +109,9 @@ class ToAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingEmpty(): void
{
$value = '';
$result = ToAccountStarts::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = ToAccountStarts::willMatchEverything($value);
$this->assertTrue($result);
}
@@ -115,8 +120,9 @@ class ToAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingNotNull(): void
{
$value = 'x';
$result = ToAccountStarts::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = ToAccountStarts::willMatchEverything($value);
$this->assertFalse($result);
}
@@ -125,8 +131,9 @@ class ToAccountStartsTest extends TestCase
*/
public function testWillMatchEverythingNull(): void
{
$value = null;
$result = ToAccountStarts::willMatchEverything($value);
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = ToAccountStarts::willMatchEverything($value);
$this->assertTrue($result);
}
}