function it_obtains_order_and_customer_statistics_by_given_channel(OrderRepositoryInterface $orderRepository, CustomerRepositoryInterface $customerRepository, ChannelInterface $channel) { $expectedStats = new DashboardStatistics(450, 2, 6); $orderRepository->getTotalSalesForChannel($channel)->willReturn(450); $orderRepository->countByChannel($channel)->willReturn(2); $customerRepository->count()->willReturn(6); $this->getStatisticsForChannel($channel)->shouldBeLike($expectedStats); }
/** * {@inheritdoc} */ public function getStatisticsForChannel(ChannelInterface $channel) { return new DashboardStatistics($this->orderRepository->getTotalSalesForChannel($channel), $this->orderRepository->countByChannel($channel), $this->customerRepository->count()); }