public function setUp() { parent::setUp(); $plan_stub = $this->getMockBuilder('\\RTMatt\\MonthlyService\\ServicePlan')->getMock(); $plan_stub->method('getLastBackup')->willReturn(\Carbon\Carbon::now()); $plan_stub->method('getDescription')->willReturn("This is the long text description of the plan"); $months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; $report = $this->getMockBuilder('\\RTMatt\\MonthlyService\\ClientAnnualUsageReport')->disableOriginalConstructor()->getMock(); $report->name = 'Annual'; $report->hours_available = 22; $report->hours_used = 2; $report->percentage_used = 2 / 22; $plan_stub->method('getAnnualReport')->willReturn($report); $month_reports = []; foreach ($months as $month) { $stub = new \RTMatt\MonthlyService\ServiceMonth(['name' => $month, 'start_date' => Carbon::now()]); $month_reports[] = $stub->getUsageReport(); } $plan_stub->method('getMonthlyReports')->willReturn($month_reports); $this->client_report = new \RTMatt\MonthlyService\ClientServiceReport($plan_stub); }
/** @test * @expectedException \RTMatt\MonthlyService\Exceptions\ServiceMonthIncompatableStartDateException */ public function it_throws_an_exception_when_trying_to_get_pretty_name_without_start_date() { $stub = new \RTMatt\MonthlyService\ServiceMonth(['name' => str_random(5)]); $stub->getUsageReport(); }