function it_obtains_order_and_customer_statistics_from_the_repositories(OrderRepositoryInterface $orderRepository, CustomerRepositoryInterface $customerRepository) { $expectedStats = new DashboardStatistics(450, 2, 6); $orderRepository->getTotalSales()->willReturn(450); $orderRepository->count()->willReturn(2); $customerRepository->count()->willReturn(6); $this->getStatistics()->shouldBeLike($expectedStats); }
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()); }
/** * {@inheritdoc} */ public function getStatistics() { return new DashboardStatistics($this->orderRepository->getTotalSales(), $this->orderRepository->count(), $this->customerRepository->count()); }