mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Code cleanup.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user