amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']); } /** * @param FunctionalTester $I */ public function alreadyRelated(FunctionalTester $I) { $group = TransactionGroup::first(); $journal = $group->transactionjournals()->first(); $I->wantTo('see already related transactions'); $I->amOnPage('/related/alreadyRelated/' . $journal->id); $I->see('Big expense in '); } /** * @param FunctionalTester $I */ public function alreadyRelatedNoRelations(FunctionalTester $I) { $journal = TransactionJournal::first(); $I->wantTo('see already related transactions for a journal without any'); $I->amOnPage('/related/alreadyRelated/' . $journal->id); $I->see('[]'); } /** * @param FunctionalTester $I */ public function relate(FunctionalTester $I) { $journal = TransactionJournal::leftJoin( 'transaction_group_transaction_journal', 'transaction_journals.id', '=', 'transaction_group_transaction_journal.transaction_journal_id' ) ->whereNull('transaction_group_transaction_journal.transaction_group_id')->first(['transaction_journals.*']); $otherJournal = TransactionJournal::leftJoin( 'transaction_group_transaction_journal', 'transaction_journals.id', '=', 'transaction_group_transaction_journal.transaction_journal_id' ) ->whereNull('transaction_group_transaction_journal.transaction_group_id')->where( 'transaction_journals.id', '!=', $journal->id )->first( ['transaction_journals.*'] ); $I->wantTo('relate two journals'); $I->sendAjaxPostRequest('/related/relate/' . $journal->id . '/' . $otherJournal->id); $I->see('true'); } /** * @param FunctionalTester $I */ public function related(FunctionalTester $I) { $group = TransactionGroup::first(); $journal = $group->transactionjournals()->first(); $I->wantTo('see the popup with already related transactions'); $I->amOnPage('/related/related/' . $journal->id); $I->see('Big expense in '); } /** * @param FunctionalTester $I */ public function removeRelation(FunctionalTester $I) { $group = TransactionGroup::first(); $one = $group->transactionjournals[0]; $two = $group->transactionjournals[1]; $I->wantTo('relate two journals'); $I->amOnPage('/related/removeRelation/' . $one->id . '/' . $two->id); $I->see('true'); } /** * @param FunctionalTester $I */ public function search(FunctionalTester $I) { $one = TransactionJournal::first();//$group = TransactionGroup::first(); //$one = $group->transactionjournals[0]; $I->wantTo('search for a transaction to relate'); $I->sendAjaxPostRequest('/related/search/' . $one->id . '?searchValue=expense'); $I->see('Big expense in'); } }