Code cleanup.

This commit is contained in:
James Cole
2017-11-22 21:12:27 +01:00
parent 4e6b782204
commit 781ca052d8
142 changed files with 213 additions and 859 deletions

View File

@@ -18,10 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit;
use Tests\TestCase;
@@ -30,8 +28,6 @@ class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Handlers\Events;
use FireflyIII\Events\RegisteredUser;
use FireflyIII\Events\RequestedNewPassword;
use FireflyIII\Handlers\Events\UserEventHandler;
@@ -36,7 +34,6 @@ use Tests\TestCase;
/**
* Class UserEventHandlerTest
*
* @package Tests\Unit\Handlers\Events
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -76,7 +73,7 @@ class UserEventHandlerTest extends TestCase
Mail::assertSent(
RequestedNewPasswordMail::class, function ($mail) use ($user) {
return $mail->hasTo($user->email) && $mail->ipAddress === '127.0.0.1';
return $mail->hasTo($user->email) && '127.0.0.1' === $mail->ipAddress;
}
);
@@ -99,11 +96,10 @@ class UserEventHandlerTest extends TestCase
// must send user an email:
Mail::assertSent(
RegisteredUserMail::class, function ($mail) use ($user) {
return $mail->hasTo($user->email) && $mail->ipAddress === '127.0.0.1';
return $mail->hasTo($user->email) && '127.0.0.1' === $mail->ipAddress;
}
);
$this->assertTrue(true);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Helpers;
use FireflyIII\Helpers\Attachments\AttachmentHelper;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\TransactionJournal;
@@ -34,7 +32,6 @@ use Tests\TestCase;
/**
* Class AttachmentHelperTest
*
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -63,7 +60,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::hasFile
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
*
*/
public function testInvalidMime()
{
@@ -93,7 +89,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/
public function testSave()
{
@@ -129,7 +124,6 @@ class AttachmentHelperTest extends TestCase
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getMessages
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getErrors
* @covers \FireflyIII\Helpers\Attachments\AttachmentHelper::getAttachments
*
*/
public function testSaveSecond()
{
@@ -146,6 +140,4 @@ class AttachmentHelperTest extends TestCase
$this->assertCount(0, $messages);
$this->assertEquals('Uploaded file "apple-touch-icon.png" is already attached to this object.', $errors->first());
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Helpers;
use Carbon\Carbon;
use FireflyIII\Helpers\Chart\MetaPieChart;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/**
* Class MetaPieChartTest
*
* @package Tests\Unit\Helpers
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -87,7 +84,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart();
$helper->setUser($this->user());
$helper->setStart($som);
@@ -98,12 +94,10 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0);
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(true);
}
/**
@@ -149,7 +143,6 @@ class MetaPieChartTest extends TestCase
$accountRepos->shouldReceive('find')->withArgs([1])->andReturn($accounts[1]);
$accountRepos->shouldReceive('find')->withArgs([2])->andReturn($accounts[2]);
$helper = new MetaPieChart();
$helper->setCollectOtherObjects(true);
$helper->setUser($this->user());
@@ -161,20 +154,18 @@ class MetaPieChartTest extends TestCase
$keys = array_keys($chart);
$this->assertEquals($keys[0], $accounts[1]->name);
$this->assertEquals($keys[1], $accounts[2]->name);
$this->assertTrue(bccomp('1000', $chart[$accounts[1]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart[$accounts[2]->name]) === 0);
$this->assertTrue(bccomp('1000', $chart['Everything else']) === 0);
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[1]->name]));
$this->assertTrue(0 === bccomp('1000', $chart[$accounts[2]->name]));
$this->assertTrue(0 === bccomp('1000', $chart['Everything else']));
$this->assertTrue(true);
}
private function fakeOthers(): Collection
{
$set = new Collection;
for ($i = 0; $i < 30; $i++) {
for ($i = 0; $i < 30; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -193,7 +184,7 @@ class MetaPieChartTest extends TestCase
private function fakeTransactions(): Collection
{
$set = new Collection;
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -206,7 +197,7 @@ class MetaPieChartTest extends TestCase
$set->push($transaction);
}
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = new Transaction;
// basic fields.
@@ -221,5 +212,4 @@ class MetaPieChartTest extends TestCase
return $set;
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\Import\Converter;
@@ -28,8 +27,6 @@ use Tests\TestCase;
/**
* Class AmountTest
*
* @package Tests\Unit\Import\Converter
*/
class AmountTest extends TestCase
{
@@ -83,12 +80,11 @@ class AmountTest extends TestCase
'1.234' => '1234',
'1.234,5' => '1234.5',
'1.234,56' => '1234.56',
];
foreach ($values as $value => $expected) {
$converter = new Amount;
$result = $converter->convert($value);
$this->assertEquals($expected, $result,sprintf('The original value was %s', $value));
$this->assertEquals($expected, $result, sprintf('The original value was %s', $value));
}
}
@@ -101,6 +97,4 @@ class AmountTest extends TestCase
$result = $converter->convert(null);
$this->assertEquals('0', $result);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
@@ -46,7 +44,6 @@ class AddTagTest extends TestCase
$result = $action->act($journal);
$this->assertFalse($result);
$this->assertDatabaseHas('tag_transaction_journal', ['tag_id' => 2, 'transaction_journal_id' => 1]);
}
/**
@@ -64,7 +61,5 @@ class AddTagTest extends TestCase
// find newly created tag:
$tag = Tag::orderBy('id', 'DESC')->first();
$this->assertDatabaseHas('tag_transaction_journal', ['tag_id' => $tag->id, 'transaction_journal_id' => 1]);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\AppendDescription;
@@ -48,7 +46,5 @@ class AppendDescriptionTest extends TestCase
$journal = TransactionJournal::find(1);
$this->assertEquals($oldDescription . 'APPEND', $journal->description);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class AppendNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class AppendNotesTest extends TestCase
{
@@ -64,7 +60,6 @@ class AppendNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($start . $toAppend, $newNote->text);
}
/**
@@ -90,6 +85,5 @@ class AppendNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($toAppend, $newNote->text);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\ClearBudget;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class ClearBudgetTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearBudgetTest extends TestCase
{
@@ -57,6 +53,5 @@ class ClearBudgetTest extends TestCase
// assert result
$this->assertEquals(0, $journal->budgets()->count());
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
@@ -30,8 +29,6 @@ use Tests\TestCase;
/**
* Class ClearCategoryTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearCategoryTest extends TestCase
{
@@ -56,6 +53,5 @@ class ClearCategoryTest extends TestCase
// assert result
$this->assertEquals(0, $journal->categories()->count());
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class ClearNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class ClearNotesTest extends TestCase
{
@@ -63,6 +59,5 @@ class ClearNotesTest extends TestCase
// assert result
$this->assertEquals(0, $journal->notes()->count());
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\PrependDescription;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class PrependDescriptionTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class PrependDescriptionTest extends TestCase
{
@@ -59,6 +55,5 @@ class PrependDescriptionTest extends TestCase
// assert result
$this->assertEquals($prepend . $description, $journal->description);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class PrependNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class PrependNotesTest extends TestCase
{
@@ -64,7 +60,6 @@ class PrependNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($toPrepend . $start, $newNote->text);
}
/**
@@ -90,6 +85,5 @@ class PrependNotesTest extends TestCase
$newNote = $journal->notes()->first();
$this->assertEquals($toPrepend, $newNote->text);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\RemoveAllTags;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class RemoveAllTagsTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class RemoveAllTagsTest extends TestCase
{

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\RemoveTag;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class RemoveTagTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class RemoveTagTest extends TestCase
{

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Actions\SetBudget;
@@ -31,8 +29,6 @@ use Tests\TestCase;
/**
* Class SetBudgetTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetBudgetTest extends TestCase
{

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
@@ -30,8 +29,6 @@ use Tests\TestCase;
/**
* Class SetCategoryTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetCategoryTest extends TestCase
{

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
@@ -30,8 +29,6 @@ use Tests\TestCase;
/**
* Class SetDescriptionTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetDescriptionTest extends TestCase
{
@@ -58,6 +55,5 @@ class SetDescriptionTest extends TestCase
// assert result
$this->assertEquals($newDescription, $journal->description);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use DB;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\RuleAction;
@@ -37,8 +35,6 @@ use Tests\TestCase;
* Try split journal
*
* Class SetDestinationAccountTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetDestinationAccountTest extends TestCase
{
@@ -183,5 +179,4 @@ class SetDestinationAccountTest extends TestCase
$result = $action->act($journal);
$this->assertFalse($result);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
@@ -32,8 +30,6 @@ use Tests\TestCase;
/**
* Class SetNotesTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetNotesTest extends TestCase
{
@@ -64,7 +60,6 @@ class SetNotesTest extends TestCase
// assert result
$this->assertEquals(1, $journal->notes()->count());
$this->assertEquals($note->id, $journal->notes()->first()->id);
}
/**

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Actions;
@@ -34,8 +33,6 @@ use Tests\TestCase;
/**
* Class SetSourceAccountTest
*
* @package Tests\Unit\TransactionRules\Actions
*/
class SetSourceAccountTest extends TestCase
{
@@ -180,5 +177,4 @@ class SetSourceAccountTest extends TestCase
$result = $action->act($journal);
$this->assertFalse($result);
}
}

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\AmountExactly;
use Tests\TestCase;
/**
* Class AmountExactlyTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class AmountExactlyTest extends TestCase
{
@@ -78,6 +74,4 @@ class AmountExactlyTest extends TestCase
$result = AmountExactly::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\AmountLess;
use Tests\TestCase;
/**
* Class AmountLessTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class AmountLessTest extends TestCase
{
@@ -90,6 +86,4 @@ class AmountLessTest extends TestCase
$result = AmountLess::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\AmountMore;
use Tests\TestCase;
/**
* Class AmountMoreTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class AmountMoreTest extends TestCase
{
@@ -100,6 +96,4 @@ class AmountMoreTest extends TestCase
$result = AmountMore::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\BudgetIs;
use Tests\TestCase;
/**
* Class BudgetIsTest
*
* @package Unit\TransactionRules\Triggers
*/
class BudgetIsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\BudgetIs::triggered
*/
@@ -64,7 +59,6 @@ class BudgetIsTest extends TestCase
$journal->budgets()->save($budget);
$this->assertEquals(1, $journal->budgets()->count());
$trigger = BudgetIs::makeFromStrings($otherBudget->name, false);
$result = $trigger->triggered($journal);
$this->assertFalse($result);
@@ -84,7 +78,6 @@ class BudgetIsTest extends TestCase
$this->assertEquals(0, $journal->budgets()->count());
$this->assertEquals(1, $transaction->budgets()->count());
$trigger = BudgetIs::makeFromStrings($budget->name, false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\CategoryIs;
use Tests\TestCase;
/**
* Class CategoryIsTest
*
* @package Unit\TransactionRules\Triggers
*/
class CategoryIsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\CategoryIs::triggered
*/
@@ -64,7 +59,6 @@ class CategoryIsTest extends TestCase
$journal->categories()->save($category);
$this->assertEquals(1, $journal->categories()->count());
$trigger = CategoryIs::makeFromStrings($otherCategory->name, false);
$result = $trigger->triggered($journal);
$this->assertFalse($result);
@@ -84,7 +78,6 @@ class CategoryIsTest extends TestCase
$this->assertEquals(0, $journal->categories()->count());
$this->assertEquals(1, $transaction->categories()->count());
$trigger = CategoryIs::makeFromStrings($category->name, false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\DescriptionContains;
use Tests\TestCase;
/**
* Class DescriptionContains
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class DescriptionContainsTest extends TestCase
{

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\DescriptionEnds;
use Tests\TestCase;
/**
* Class DescriptionEnds
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class DescriptionEndsTest extends TestCase
{

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\DescriptionIs;
use Tests\TestCase;
/**
* Class DescriptionIs
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class DescriptionIsTest extends TestCase
{

View File

@@ -18,20 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\DescriptionStarts;
use Tests\TestCase;
/**
* Class DescriptionStarts
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class DescriptionStartsTest extends TestCase
{

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class FromAccountContainsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class FromAccountContainsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountContains::triggered
*/
@@ -90,6 +86,4 @@ class FromAccountContainsTest extends TestCase
$result = FromAccountContains::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class FromAccountEndsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class FromAccountEndsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountEnds::triggered
*/
@@ -104,6 +100,4 @@ class FromAccountEndsTest extends TestCase
$result = FromAccountEnds::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class FromAccountIsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class FromAccountIsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountIs::triggered
*/
@@ -49,7 +45,6 @@ class FromAccountIsTest extends TestCase
$this->assertTrue($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountIs::triggered
*/
@@ -91,5 +86,4 @@ class FromAccountIsTest extends TestCase
$result = FromAccountIs::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class FromAccountStartsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class FromAccountStartsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\FromAccountStarts::triggered
*/
@@ -104,6 +100,4 @@ class FromAccountStartsTest extends TestCase
$result = FromAccountStarts::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,8 +28,6 @@ use Tests\TestCase;
/**
* Class HasAnyBudgetTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class HasAnyBudgetTest extends TestCase
{
@@ -76,7 +73,7 @@ class HasAnyBudgetTest extends TestCase
// append to transaction
foreach ($journal->transactions()->get() as $index => $transaction) {
$transaction->budgets()->detach();
if ($index === 0) {
if (0 === $index) {
$transaction->budgets()->save($budget);
}
}
@@ -95,5 +92,4 @@ class HasAnyBudgetTest extends TestCase
$result = HasAnyBudget::willMatchEverything($value);
$this->assertFalse($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,8 +28,6 @@ use Tests\TestCase;
/**
* Class HasAnyCategoryTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class HasAnyCategoryTest extends TestCase
{
@@ -76,7 +73,7 @@ class HasAnyCategoryTest extends TestCase
// append to transaction
foreach ($journal->transactions()->get() as $index => $transaction) {
$transaction->categories()->detach();
if ($index === 0) {
if (0 === $index) {
$transaction->categories()->save($category);
}
}
@@ -95,5 +92,4 @@ class HasAnyCategoryTest extends TestCase
$result = HasAnyCategory::willMatchEverything($value);
$this->assertFalse($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,8 +28,6 @@ use Tests\TestCase;
/**
* Class HasAnyTagTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class HasAnyTagTest extends TestCase
{
@@ -72,5 +69,4 @@ class HasAnyTagTest extends TestCase
$result = HasAnyTag::willMatchEverything($value);
$this->assertFalse($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,8 +28,6 @@ use Tests\TestCase;
/**
* Class HasAttachmentTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class HasAttachmentTest extends TestCase
{
@@ -81,5 +78,4 @@ class HasAttachmentTest extends TestCase
$result = HasAttachment::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\HasNoBudget;
use Tests\TestCase;
/**
* Class HasNoBudgetTest
*
* @package Unit\TransactionRules\Triggers
*/
class HasNoBudgetTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\HasNoBudget::triggered
*/
@@ -61,7 +56,6 @@ class HasNoBudgetTest extends TestCase
$journal->budgets()->detach();
$this->assertEquals(0, $journal->budgets()->count());
$trigger = HasNoBudget::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);
@@ -81,7 +75,6 @@ class HasNoBudgetTest extends TestCase
$this->assertEquals(0, $journal->budgets()->count());
$this->assertEquals(1, $transaction->budgets()->count());
$trigger = HasNoBudget::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertFalse($result);

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\HasNoCategory;
use Tests\TestCase;
/**
* Class HasNoCategoryTest
*
* @package Unit\TransactionRules\Triggers
*/
class HasNoCategoryTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\HasNoCategory::triggered
*/
@@ -61,7 +56,6 @@ class HasNoCategoryTest extends TestCase
$journal->categories()->detach();
$this->assertEquals(0, $journal->categories()->count());
$trigger = HasNoCategory::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);
@@ -81,7 +75,6 @@ class HasNoCategoryTest extends TestCase
$this->assertEquals(0, $journal->categories()->count());
$this->assertEquals(1, $transaction->categories()->count());
$trigger = HasNoCategory::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertFalse($result);

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\HasNoTag;
use Tests\TestCase;
/**
* Class HasNoTagTest
*
* @package Unit\TransactionRules\Triggers
*/
class HasNoTagTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\HasNoTag::triggered
*/
@@ -45,7 +40,6 @@ class HasNoTagTest extends TestCase
$journal->tags()->detach();
$this->assertEquals(0, $journal->tags()->count());
$trigger = HasNoTag::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesAny;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesAnyTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesAnyTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesAny::triggered
*/

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesAre;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesAreTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesAreTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesAre::triggered
*/
@@ -97,7 +92,6 @@ class NotesAreTest extends TestCase
$this->assertFalse($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesAre::willMatchEverything
*/

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesContain;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesContainTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesContainTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered
*/
@@ -123,7 +118,6 @@ class NotesContainTest extends TestCase
$this->assertTrue($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesContain::willMatchEverything
*/

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesEmpty;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesEmptyTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesEmptyTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesEmpty::triggered
*/
@@ -90,5 +85,4 @@ class NotesEmptyTest extends TestCase
$result = NotesEmpty::willMatchEverything($value);
$this->assertFalse($result);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesEnd;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesEndTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesEndTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesEnd::triggered
*/
@@ -95,7 +90,6 @@ class NotesEndTest extends TestCase
$this->assertTrue($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesEnd::willMatchEverything
*/

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\NotesStart;
@@ -31,12 +29,9 @@ use Tests\TestCase;
/**
* Class NotesStartTest
*
* @package Unit\TransactionRules\Triggers
*/
class NotesStartTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesStart::triggered
*/
@@ -95,7 +90,6 @@ class NotesStartTest extends TestCase
$this->assertTrue($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\NotesStart::willMatchEverything
*/

View File

@@ -18,24 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\TransactionRules\Triggers\TagIs;
use Tests\TestCase;
/**
* Class TagIsTest
*
* @package Unit\TransactionRules\Triggers
*/
class TagIsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\TagIs::triggered
*/
@@ -61,7 +56,7 @@ class TagIsTest extends TestCase
$search = '';
foreach ($tags as $index => $tag) {
$journal->tags()->save($tag);
if ($index === 1) {
if (1 === $index) {
$search = $tag->tag;
}
}
@@ -82,7 +77,6 @@ class TagIsTest extends TestCase
$this->assertFalse($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\TagIs::willMatchEverything
*/

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class ToAccountContainsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class ToAccountContainsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\ToAccountContains::triggered
*/
@@ -88,6 +84,4 @@ class ToAccountContainsTest extends TestCase
$result = ToAccountContains::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class ToAccountEndsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class ToAccountEndsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\ToAccountEnds::triggered
*/
@@ -104,6 +100,4 @@ class ToAccountEndsTest extends TestCase
$result = ToAccountEnds::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class ToAccountIsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class ToAccountIsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::triggered
*/
@@ -49,7 +45,6 @@ class ToAccountIsTest extends TestCase
$this->assertTrue($result);
}
/**
* @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::triggered
*/
@@ -91,6 +86,4 @@ class ToAccountIsTest extends TestCase
$result = ToAccountIs::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,12 +28,9 @@ use Tests\TestCase;
/**
* Class ToAccountStartsTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class ToAccountStartsTest extends TestCase
{
/**
* @covers \FireflyIII\TransactionRules\Triggers\ToAccountStarts::triggered
*/
@@ -104,6 +100,4 @@ class ToAccountStartsTest extends TestCase
$result = ToAccountStarts::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Unit\TransactionRules\Triggers;
@@ -29,8 +28,6 @@ use Tests\TestCase;
/**
* Class TransactionTypeTest
*
* @package Tests\Unit\TransactionRules\Triggers
*/
class TransactionTypeTest extends TestCase
{
@@ -76,6 +73,4 @@ class TransactionTypeTest extends TestCase
$result = TransactionType::willMatchEverything($value);
$this->assertTrue($result);
}
}