$actual, 'display_device_limit' => $display, 'reset_traffic_method' => 1]); $this->assertSame($expected, $plan->getDisplayDeviceLimit()); $data = (new PlanResource($plan))->toArray(new Request()); $this->assertSame($actual, $data['device_limit']); $this->assertSame($display, $data['display_device_limit']); } } public function test_existing_template_variable_keeps_actual_limit(): void { $plan = new Plan(['device_limit' => 5, 'display_device_limit' => 18, 'reset_traffic_method' => 1, 'content' => '{{devices}} / {{display_devices}}']); $this->assertSame('5 / 18', (new PlanResource($plan))->toArray(new Request())['content']); } public function test_display_count_rejects_negative_fraction_and_overflow(): void { $rule = (new PlanSave())->rules()['display_device_limit']; foreach ([null, 0, 5, 200, 4294967295] as $value) { $this->assertFalse(validator(['display_device_limit' => $value], ['display_device_limit' => $rule])->fails()); } foreach ([-1, 1.5, 'abc', 4294967296] as $value) { $this->assertTrue(validator(['display_device_limit' => $value], ['display_device_limit' => $rule])->fails()); } } }