| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function testTransactionRelation(): void |
||
| 34 | { |
||
| 35 | $transaction = new Transaction(); |
||
| 36 | $category = new Category(); |
||
| 37 | |||
| 38 | $transaction->setCategory($category); |
||
| 39 | |||
| 40 | self::assertCount(1, $category->getTransactions()); |
||
| 41 | |||
| 42 | self::assertSame($transaction->getCategory(), $category); |
||
| 43 | |||
| 44 | $transaction2 = new Transaction(); |
||
| 45 | $category2 = new Category(); |
||
| 46 | $transaction->setCategory($category2); |
||
| 47 | $transaction2->setCategory($category2); |
||
| 48 | self::assertCount(0, $category->getTransactions()); |
||
| 49 | self::assertCount(2, $category2->getTransactions()); |
||
| 50 | } |
||
| 52 |