mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Speed up category test.
This commit is contained in:
parent
6f64c19c32
commit
26fa2b0b74
@ -36,7 +36,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use Log;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -88,10 +88,11 @@ class ShowController extends Controller
|
||||
*/
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
Log::debug('Now in show()');
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
$start = $start ?? session('start', Carbon::create()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end');
|
||||
$end = $end ?? session('end', Carbon::create()->startOfMonth());
|
||||
$subTitleIcon = 'fa-bar-chart';
|
||||
$moment = '';
|
||||
$page = (int)$request->get('page');
|
||||
@ -112,6 +113,8 @@ class ShowController extends Controller
|
||||
$transactions = $collector->getPaginatedJournals();
|
||||
$transactions->setPath($path);
|
||||
|
||||
Log::debug('End of show()');
|
||||
|
||||
return view('categories.show', compact('category', 'transactions', 'moment', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class ShowControllerTest extends TestCase
|
||||
*/
|
||||
public function testShow(string $range): void
|
||||
{
|
||||
Log::debug('Test show()');
|
||||
Log::debug(sprintf('Test show(%s)', $range));
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
@ -113,7 +113,7 @@ class ShowControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowAll(string $range): void
|
||||
{
|
||||
Log::debug('Test showAll()');
|
||||
Log::debug(sprintf('Test showAll(%s)', $range));
|
||||
// mock stuff
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
@ -151,7 +151,7 @@ class ShowControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowByDate(string $range): void
|
||||
{
|
||||
Log::debug('Test showbydate()');
|
||||
Log::debug(sprintf('Test testShowByDate(%s)', $range));
|
||||
// mock stuff
|
||||
$transaction = factory(Transaction::class)->make();
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
@ -199,9 +199,12 @@ class ShowControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowEmpty(string $range): void
|
||||
{
|
||||
Log::debug('Test showempty()');
|
||||
$latestJournal = $this->user()->transactionJournals()
|
||||
->orderBy('date','DESC')->first();
|
||||
|
||||
Log::debug(sprintf('Test testShowEmpty(%s)', $range));
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
|
||||
$journalRepos->shouldReceive('firstNull')->twice()->andReturn($latestJournal);
|
||||
|
||||
// mock stuff
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
|
Loading…
Reference in New Issue
Block a user