createStub(DsdAllocatorInterface::class); $allocator->method('next')->willReturn(1); $reader = new RandomWeighbridgeReader($allocator); $site = $this->createStub(SiteInterface::class); for ($i = 0; $i < 500; ++$i) { $reading = $reader->read($site); self::assertGreaterThanOrEqual(10000, $reading->weight); self::assertLessThanOrEqual(50000, $reading->weight); } } /** * RG-5.04 : le DSD renvoye par la lecture est celui fourni par l'allocateur * de site (le reader ne calcule pas le DSD lui-meme). */ public function testReadDelegatesDsdToAllocator(): void { $allocator = $this->createStub(DsdAllocatorInterface::class); $allocator->method('next')->willReturn(42); $reader = new RandomWeighbridgeReader($allocator); $reading = $reader->read($this->createStub(SiteInterface::class)); self::assertSame(42, $reading->dsd); } }