Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Commit

Permalink
Merge 12b57cb into 074f7a2
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Wollants committed Feb 23, 2017
2 parents 074f7a2 + 12b57cb commit 8174920
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/UiTPASEventSagaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,38 @@ public function it_creates_a_new_uitpas_aggregate_and_registers_an_uitpas_event_
);
}

/**
* @test
*/
public function it_handles_exception_for_events_imported_from_udb2()
{
$this->mockGetEventToThrow();

$cdbXml = file_get_contents(__DIR__ . '/cdbxml-samples/event-with-uitpas-organizer-and-price.xml');

$cdbXmlNamespaceUri = 'http://www.cultuurdatabank.com/XMLSchema/CdbXSD/3.3/FINAL';

$expectedPriceInfo = new PriceInfo(
new BasePrice(
Price::fromFloat(5.5),
Currency::fromNative('EUR')
)
);

$this->scenario
->when(new EventImportedFromUDB2($this->eventId, $cdbXml, $cdbXmlNamespaceUri))
->then(
[
new CreateUiTPASAggregate($this->eventId, []),
new RegisterUiTPASEvent(
$this->eventId,
$this->uitpasOrganizerId,
$expectedPriceInfo
),
]
);
}

/**
* @test
*/
Expand Down Expand Up @@ -1242,4 +1274,14 @@ private function mockGetEvent(array $distributionKeys = [])
->with($this->eventId)
->willReturn($uitpasEvent);
}

private function mockGetEventToThrow()
{
$this->cultureFeedUitpas->expects($this->once())
->method('getEvent')
->will($this->throwException(new \CultureFeed_Exception(
'Event not found',
0
)));
}
}

0 comments on commit 8174920

Please sign in to comment.