2015-05-14 02:01:10 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use FireflyIII\Helpers\Report\ReportHelper;
|
|
|
|
use FireflyIII\Models\AccountMeta;
|
|
|
|
use FireflyIII\Models\PiggyBankRepetition;
|
|
|
|
use FireflyIII\Models\Transaction;
|
|
|
|
use League\FactoryMuffin\Facade as FactoryMuffin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ReportHelperTest
|
|
|
|
*/
|
|
|
|
class ReportHelperTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var ReportHelper
|
|
|
|
*/
|
|
|
|
protected $object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
|
|
* This method is called before a test is executed.
|
|
|
|
*/
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
FactoryMuffin::create('FireflyIII\User');
|
2015-05-16 09:04:51 -05:00
|
|
|
$query = new \FireflyIII\Helpers\Report\ReportQuery();
|
|
|
|
$this->object = new ReportHelper($query);
|
2015-05-14 02:01:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
|
|
* This method is called after a test is executed.
|
|
|
|
*/
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
parent::tearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testListOfMonths()
|
|
|
|
{
|
|
|
|
// start of year up until now
|
|
|
|
$date = new Carbon('2015-01-01');
|
|
|
|
$now = new Carbon;
|
|
|
|
$diff = $now->diffInMonths($date) + 1; // the month itself.
|
|
|
|
$result = $this->object->listOfMonths($date);
|
|
|
|
|
|
|
|
$this->assertCount($diff, $result[2015]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-05-20 12:56:14 -05:00
|
|
|
}
|