unil-lettres /
dilps-tiresias
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace ApplicationTest\Model; |
||
| 6 | |||
| 7 | use Application\Model\Card; |
||
| 8 | use Application\Model\Dating; |
||
| 9 | use Cake\Chronos\Chronos; |
||
|
0 ignored issues
–
show
|
|||
| 10 | use DateTimeZone; |
||
| 11 | use PHPUnit\Framework\TestCase; |
||
| 12 | |||
| 13 | class DatingTest extends TestCase |
||
| 14 | { |
||
| 15 | public function testFrom(): void |
||
| 16 | { |
||
| 17 | $dating = new Dating(); |
||
| 18 | $d1 = new Chronos('now', new DateTimeZone('UTC')); |
||
| 19 | $d1 = $d1->setDate(-1200, 2, 3)->setTime(0, 0, 0, 0); |
||
| 20 | $dating->setFrom($d1); |
||
| 21 | $d2 = $dating->getFrom(); |
||
| 22 | |||
| 23 | self::assertNotSame($d1, $d2); |
||
| 24 | self::assertEquals($d1, $d2); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function testTo(): void |
||
| 28 | { |
||
| 29 | $dating = new Dating(); |
||
| 30 | $d1 = new Chronos('2010-02-03', new DateTimeZone('UTC')); |
||
| 31 | $dating->setTo($d1); |
||
| 32 | $d2 = $dating->getTo(); |
||
| 33 | |||
| 34 | self::assertNotSame($d1, $d2); |
||
| 35 | self::assertEquals($d1, $d2); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function testDatingRelation(): void |
||
| 39 | { |
||
| 40 | $card = new Card(); |
||
| 41 | self::assertCount(0, $card->getDatings(), 'should have no datings'); |
||
| 42 | |||
| 43 | $dating = new Dating(); |
||
| 44 | $dating->setCard($card); |
||
| 45 | |||
| 46 | self::assertSame($card, $dating->getCard(), 'should belong to the card'); |
||
| 47 | self::assertCount(1, $card->getDatings(), 'should have the added dating'); |
||
| 48 | self::assertSame($dating, $card->getDatings()->first(), 'should be able to retrieve added dating'); |
||
| 49 | |||
| 50 | $dating->setCard($card); |
||
| 51 | self::assertSame($card, $dating->getCard(), 'should still belong to exactly 1 card'); |
||
| 52 | self::assertCount(1, $card->getDatings(), 'should still have the same unique dating'); |
||
| 53 | |||
| 54 | $dating2 = new Dating(); |
||
| 55 | $dating2->setCard($card); |
||
| 56 | self::assertCount(2, $card->getDatings(), 'should be able to add second dating'); |
||
| 57 | |||
| 58 | $dating->setCard(new Card()); |
||
| 59 | self::assertCount(1, $card->getDatings(), 'should be able to remove first dating'); |
||
| 60 | self::assertSame($dating2, $card->getDatings()->first(), 'should be have only second dating left'); |
||
| 61 | } |
||
| 62 | } |
||
| 63 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths