public function testRateLimitRemaining() { $repository = new MemoryRepository(); $strategy = new BasicStrategy($repository); $event = new Event(); $actor = new Actor(); // Set the cost to 5 $event->setCost(5); // Set timeframe and allowed attempts $strategy->setTimeframe(1); $strategy->setAllow(10); // Handle the event twice $strategy->handle($actor, $event); $this->assertEquals(5, $strategy->getRemaining($actor, $event)); }
public function testCost() { $event = new Event(); $event->setCost(100); $this->assertEquals(100, $event->getCost()); }