| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function testFindByHash() |
||
| 15 | { |
||
| 16 | $snapshot = $this->makeSnapshot('custom error', 777); |
||
| 17 | $this->handleSnapshot($snapshot, true); |
||
| 18 | |||
| 19 | $hash = AggregationHandler\Services\SnapshotService::makeHash($snapshot); |
||
| 20 | $hash2 = 'some second random hash'; |
||
| 21 | |||
| 22 | /** @var SnapshotSource $source */ |
||
| 23 | $source = $this->container->get(SnapshotSource::class); |
||
| 24 | $this->assertNotEmpty($source->findByHash($hash)); |
||
| 25 | $this->assertEmpty($source->findByHash($hash2)); |
||
| 26 | |||
| 27 | $record = $source->findByHash($hash); |
||
| 28 | $record->exception_hash = $hash2; |
||
|
|
|||
| 29 | $record->save(); |
||
| 30 | |||
| 31 | $this->assertEmpty($source->findByHash($hash)); |
||
| 32 | $this->assertNotEmpty($source->findByHash($hash2)); |
||
| 33 | } |
||
| 34 | } |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: