| @@ 76-87 (lines=12) @@ | ||
| 73 | ]; |
|
| 74 | } |
|
| 75 | ||
| 76 | public function testFetchAllAvailableDiscountCodes() |
|
| 77 | { |
|
| 78 | $mockFinder = m::mock(RepositoryInterface::class); |
|
| 79 | $mockFinder->shouldReceive('matching')->andReturn(new ArrayCollection($this->config->getDiscountCodes())); |
|
| 80 | ||
| 81 | $sut = new DiscountCodeAvailability($mockFinder, ...$this->filters); |
|
| 82 | ||
| 83 | $result = $sut->fetchAllAvailableDiscountCodes(); |
|
| 84 | ||
| 85 | self::assertTrue($result->count() === 2, 'The expected number of discount codes was not returned'); |
|
| 86 | self::assertFalse($result->contains($this->config->getDiscountCodes()['50off']), 'Expired code was included in results'); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * @dataProvider provideIsAvailable |
|
| @@ 71-82 (lines=12) @@ | ||
| 68 | ]; |
|
| 69 | } |
|
| 70 | ||
| 71 | public function testFetchAllAvailableTickets() |
|
| 72 | { |
|
| 73 | $mockFinder = m::mock(RepositoryInterface::class); |
|
| 74 | $mockFinder->shouldReceive('matching')->andReturn($this->ticketCounters); |
|
| 75 | ||
| 76 | $sut = new TicketAvailability($mockFinder, ...$this->filters); |
|
| 77 | ||
| 78 | $result = $sut->fetchAllAvailableTickets(); |
|
| 79 | ||
| 80 | self::assertTrue($result->count() === 2, 'The expected number of tickets was not returned'); |
|
| 81 | self::assertFalse($result->contains($this->ticketCounters['free']), 'Free tickets were included in the result'); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * @dataProvider provideIsAvailable |
|