'2026-04-01', 'hours' => 2.0, 'count' => 3], ]; $service = $this->createMock(HeatmapService::class); $service->method('getDailyAggregation')->willReturn($mockDays); $controller = new HeatmapController(); // Mock user via reflection (AbstractController::getUser is protected) $user = $this->createMock(User::class); $container = $this->createMock(\Symfony\Component\DependencyInjection\ContainerInterface::class); $tokenStorage = $this->createMock(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class); $token = $this->createMock(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class); $token->method('getUser')->willReturn($user); $tokenStorage->method('getToken')->willReturn($token); $container->method('has')->willReturn(true); $container->method('get')->willReturn($tokenStorage); $controller->setContainer($container); $response = $controller->data(new Request(), $service); $this->assertInstanceOf(JsonResponse::class, $response); $data = json_decode($response->getContent(), true); $this->assertArrayHasKey('days', $data); $this->assertArrayHasKey('range', $data); $this->assertCount(1, $data['days']); $this->assertArrayHasKey('begin', $data['range']); $this->assertArrayHasKey('end', $data['range']); } }