Fix tests.

This commit is contained in:
James Cole 2017-11-15 15:30:15 +01:00
parent 0c1ff98c66
commit 63d93968d0
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
7 changed files with 25 additions and 24 deletions

View File

@ -93,7 +93,7 @@ final class Entry
*
* @return Entry
*/
public static function fromTransaction(Transaction $transaction): self
public static function fromTransaction(Transaction $transaction): Entry
{
$entry = new self;
$entry->journal_id = $transaction->journal_id;

View File

@ -40,40 +40,40 @@ interface ReportGeneratorInterface
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): self;
public function setAccounts(Collection $accounts): ReportGeneratorInterface;
/**
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
public function setBudgets(Collection $budgets): self;
public function setBudgets(Collection $budgets): ReportGeneratorInterface;
/**
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
public function setCategories(Collection $categories): self;
public function setCategories(Collection $categories): ReportGeneratorInterface;
/**
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
public function setEndDate(Carbon $date): self;
public function setEndDate(Carbon $date): ReportGeneratorInterface;
/**
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
public function setStartDate(Carbon $date): self;
public function setStartDate(Carbon $date): ReportGeneratorInterface;
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): self;
public function setTags(Collection $tags): ReportGeneratorInterface;
}

View File

@ -44,54 +44,54 @@ interface MetaPieChartInterface
*
* @return MetaPieChartInterface
*/
public function setAccounts(Collection $accounts): self;
public function setAccounts(Collection $accounts): MetaPieChartInterface;
/**
* @param Collection $budgets
*
* @return MetaPieChartInterface
*/
public function setBudgets(Collection $budgets): self;
public function setBudgets(Collection $budgets): MetaPieChartInterface;
/**
* @param Collection $categories
*
* @return MetaPieChartInterface
*/
public function setCategories(Collection $categories): self;
public function setCategories(Collection $categories): MetaPieChartInterface;
/**
* @param bool $collectOtherObjects
*
* @return MetaPieChartInterface
*/
public function setCollectOtherObjects(bool $collectOtherObjects): self;
public function setCollectOtherObjects(bool $collectOtherObjects): MetaPieChartInterface;
/**
* @param Carbon $end
*
* @return MetaPieChartInterface
*/
public function setEnd(Carbon $end): self;
public function setEnd(Carbon $end): MetaPieChartInterface;
/**
* @param Carbon $start
*
* @return MetaPieChartInterface
*/
public function setStart(Carbon $start): self;
public function setStart(Carbon $start): MetaPieChartInterface;
/**
* @param Collection $tags
*
* @return MetaPieChartInterface
*/
public function setTags(Collection $tags): self;
public function setTags(Collection $tags): MetaPieChartInterface;
/**
* @param User $user
*
* @return MetaPieChartInterface
*/
public function setUser(User $user): self;
public function setUser(User $user): MetaPieChartInterface;
}

View File

@ -45,5 +45,5 @@ interface FileProcessorInterface
*
* @return FileProcessorInterface
*/
public function setJob(ImportJob $job): self;
public function setJob(ImportJob $job): FileProcessorInterface;
}

View File

@ -120,7 +120,7 @@ class TransactionMatcher
*
* @return TransactionMatcher
*/
public function setLimit(int $limit): self
public function setLimit(int $limit): TransactionMatcher
{
$this->limit = $limit;
@ -140,7 +140,7 @@ class TransactionMatcher
*
* @return TransactionMatcher
*/
public function setRange(int $range): self
public function setRange(int $range): TransactionMatcher
{
$this->range = $range;
@ -160,7 +160,7 @@ class TransactionMatcher
*
* @return TransactionMatcher
*/
public function setTriggers(array $triggers): self
public function setTriggers(array $triggers): TransactionMatcher
{
$this->triggers = $triggers;

View File

@ -550,6 +550,9 @@ class CreateMainTables extends Migration
$table->integer('transaction_journal_id', false, true);
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
// unique combi:
$table->unique(['tag_id', 'transaction_journal_id']);
}
);
}

View File

@ -72,13 +72,11 @@ class RemoveTagTest extends TestCase
public function testActNoTag()
{
// get journal, link al tags:
/** @var TransactionJournal $journal */
$journal = TransactionJournal::find(11);
$tags = $journal->user->tags()->get();
foreach ($tags as $tag) {
$journal->tags()->save($tag);
$journal->save();
}
$this->assertEquals($tags->count(), $journal->tags()->count());
$journal->tags()->sync($tags->pluck('id')->toArray());
$this->assertEquals($tags->count(), $journal->tags()->get()->count());
// fire the action:
$ruleAction = new RuleAction;