withPersonalOrganization()->create([ 'email' => 'admin@example.com', ]); $this->actingAs($user); } /** * Calls the protected getData() method of the chart widget of the given Livewire test. * * @param Testable $testable * @return array{datasets: array}>, labels: Collection} */ protected function getChartData(Testable $testable): array { /** @var ChartWidget $widget */ $widget = $testable->instance(); /** @var array{datasets: array}>, labels: Collection} $data */ $data = Closure::bind(fn (): array => $this->getData(), $widget, $widget)(); return $data; } /** * @param array{datasets: array}>, labels: Collection} $data */ protected function sumOfChartData(array $data): int { return (int) $data['datasets'][0]['data']->sum(); } }