-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests to use
BookingAvailability
- Loading branch information
1 parent
8e1366b
commit 155a535
Showing
11 changed files
with
90 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,8 +92,10 @@ public function it_should_be_creatable_from_a_complete_udb3_model_booking_info() | |
), | ||
new TelephoneNumber('044/444444'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2018-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2018-01-10T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2018-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2018-01-10T00:00:00+01:00') | ||
) | ||
); | ||
|
||
$actual = BookingInfo::fromUdb3ModelBookingInfo($udb3ModelBookingInfo); | ||
|
@@ -125,7 +127,6 @@ public function it_should_return_null_for_empty_properties(): void | |
null, | ||
null, | ||
null, | ||
null, | ||
null | ||
); | ||
|
||
|
@@ -137,24 +138,21 @@ public function it_should_return_null_for_empty_properties(): void | |
$this->assertNull($bookingInfo->getWebsite()); | ||
$this->assertNull($bookingInfo->getPhone()); | ||
$this->assertNull($bookingInfo->getEmail()); | ||
$this->assertNull($bookingInfo->getAvailabilityStarts()); | ||
$this->assertNull($bookingInfo->getAvailabilityEnds()); | ||
$this->assertNull($bookingInfo->getAvailability()); | ||
$this->assertEquals($expectedSerialized, $bookingInfo->serialize()); | ||
$this->assertEquals($expectedJson, $bookingInfo->toJsonLd()); | ||
|
||
$this->assertNull($bookingInfoWithEmptyString->getWebsite()); | ||
$this->assertNull($bookingInfoWithEmptyString->getPhone()); | ||
$this->assertNull($bookingInfoWithEmptyString->getEmail()); | ||
$this->assertNull($bookingInfoWithEmptyString->getAvailabilityStarts()); | ||
$this->assertNull($bookingInfoWithEmptyString->getAvailabilityEnds()); | ||
$this->assertNull($bookingInfoWithEmptyString->getAvailability()); | ||
$this->assertEquals($expectedSerialized, $bookingInfoWithEmptyString->serialize()); | ||
$this->assertEquals($expectedJson, $bookingInfoWithEmptyString->toJsonLd()); | ||
|
||
$this->assertNull($deserialized->getWebsite()); | ||
$this->assertNull($deserialized->getPhone()); | ||
$this->assertNull($deserialized->getEmail()); | ||
$this->assertNull($deserialized->getAvailabilityStarts()); | ||
$this->assertNull($deserialized->getAvailabilityEnds()); | ||
$this->assertNull($deserialized->getAvailability()); | ||
$this->assertEquals($expectedSerialized, $deserialized->serialize()); | ||
$this->assertEquals($expectedJson, $deserialized->toJsonLd()); | ||
} | ||
|
@@ -171,7 +169,6 @@ public function it_can_serialize_and_deserialize_partial_booking_info(): void | |
null, | ||
$phone, | ||
$email, | ||
null, | ||
null | ||
); | ||
|
||
|
@@ -215,8 +212,10 @@ public function it_ignores_obsolete_properties_when_deserializing(): void | |
), | ||
new TelephoneNumber('044/444444'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2018-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2018-01-14T23:59:59+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2018-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2018-01-14T23:59:59+01:00') | ||
) | ||
); | ||
|
||
$actual = BookingInfo::deserialize($data); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use CultuurNet\UDB3\BookingInfo; | ||
use CultuurNet\UDB3\DateTimeFactory; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Translation\Language; | ||
use CultuurNet\UDB3\Model\ValueObject\Web\EmailAddress; | ||
|
@@ -33,8 +34,10 @@ public function setUp(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
) | ||
); | ||
} | ||
|
@@ -56,8 +59,10 @@ public function it_is_possible_to_instantiate_the_command_with_parameters(): voi | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
) | ||
); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use CultuurNet\UDB3\BookingInfo; | ||
use CultuurNet\UDB3\DateTimeFactory; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Translation\Language; | ||
use CultuurNet\UDB3\Model\ValueObject\Web\EmailAddress; | ||
|
@@ -72,8 +73,10 @@ public function serializationDataProvider(): array | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
) | ||
), | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
use CultuurNet\UDB3\Model\Serializer\Event\EventDenormalizer; | ||
use CultuurNet\UDB3\Model\ValueObject\Audience\AudienceType; | ||
use CultuurNet\UDB3\Model\ValueObject\Calendar\CalendarType; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\ContactPoint; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumbers; | ||
|
@@ -684,8 +685,10 @@ public function it_creates_a_new_event_without_id_but_with_all_properties(): voi | |
), | ||
new TelephoneNumber('016 12 34 56'), | ||
new EmailAddress('[email protected]'), | ||
new DateTimeImmutable('2021-05-17T22:00:00+00:00'), | ||
new DateTimeImmutable('2021-05-21T22:00:00+00:00') | ||
BookingAvailability::fromTo( | ||
new DateTimeImmutable('2021-05-17T22:00:00+00:00'), | ||
new DateTimeImmutable('2021-05-21T22:00:00+00:00') | ||
) | ||
) | ||
), | ||
new UpdateContactPoint( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use CultuurNet\UDB3\Http\Request\Psr7RequestBuilder; | ||
use CultuurNet\UDB3\Http\Response\AssertJsonResponseTrait; | ||
use CultuurNet\UDB3\Http\Response\NoContentResponse; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Translation\Language; | ||
use CultuurNet\UDB3\Model\ValueObject\Web\EmailAddress; | ||
|
@@ -109,8 +110,10 @@ public function offerTypeDataProvider(): array | |
), | ||
new TelephoneNumber('02/1232323'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2023-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2028-01-31T23:59:59+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2023-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2028-01-31T23:59:59+01:00') | ||
) | ||
); | ||
|
||
$bookingInfoSpecialCharactersUrl = new BookingInfo( | ||
|
@@ -123,8 +126,10 @@ public function offerTypeDataProvider(): array | |
), | ||
new TelephoneNumber('02/1232323'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2023-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2028-01-31T23:59:59+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2023-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2028-01-31T23:59:59+01:00') | ||
) | ||
); | ||
|
||
return [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
use CultuurNet\UDB3\Model\ValueObject\Calendar\StatusReason; | ||
use CultuurNet\UDB3\Model\ValueObject\Calendar\StatusType; | ||
use CultuurNet\UDB3\Model\ValueObject\Calendar\TranslatedStatusReason; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\ContactPoint; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumbers; | ||
|
@@ -872,8 +873,10 @@ public function it_updates_an_existing_place(): void | |
), | ||
new TelephoneNumber('016 10 20 30'), | ||
new EmailAddress('[email protected]'), | ||
new DateTimeImmutable('2020-05-17T22:00:00+00:00'), | ||
new DateTimeImmutable('2028-05-17T22:00:00+00:00'), | ||
BookingAvailability::fromTo( | ||
new DateTimeImmutable('2020-05-17T22:00:00+00:00'), | ||
new DateTimeImmutable('2028-05-17T22:00:00+00:00') | ||
) | ||
) | ||
), | ||
new UpdateContactPoint( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace CultuurNet\UDB3\Model\Import\Offer; | ||
|
||
use CultuurNet\UDB3\BookingInfo as LegacyBookingInfo; | ||
use CultuurNet\UDB3\Calendar\Calendar; | ||
use CultuurNet\UDB3\DateTimeFactory; | ||
use CultuurNet\UDB3\Event\EventType; | ||
|
@@ -311,7 +312,7 @@ public function it_should_return_price_info_if_there_is_any(): void | |
*/ | ||
public function it_should_return_empty_booking_info_by_default(): void | ||
{ | ||
$expected = new \CultuurNet\UDB3\BookingInfo(); | ||
$expected = new LegacyBookingInfo(); | ||
$actual = $this->adapter->getBookingInfo(); | ||
$this->assertEquals($expected, $actual); | ||
} | ||
|
@@ -321,7 +322,7 @@ public function it_should_return_empty_booking_info_by_default(): void | |
*/ | ||
public function it_should_return_booking_info_if_there_is_any(): void | ||
{ | ||
$expected = new \CultuurNet\UDB3\BookingInfo( | ||
$expected = new LegacyBookingInfo( | ||
new WebsiteLink( | ||
new Url('https://www.publiq.be'), | ||
new TranslatedWebsiteLabel( | ||
|
@@ -331,8 +332,10 @@ public function it_should_return_booking_info_if_there_is_any(): void | |
), | ||
new TelephoneNumber('044/444444'), | ||
new EmailAddress('[email protected]'), | ||
new DateTimeImmutable('2018-01-01T10:00:00+01:00'), | ||
new DateTimeImmutable('2018-01-10T10:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
new DateTimeImmutable('2018-01-01T10:00:00+01:00'), | ||
new DateTimeImmutable('2018-01-10T10:00:00+01:00') | ||
) | ||
); | ||
$actual = $this->completeAdapter->getBookingInfo(); | ||
$this->assertEquals($expected, $actual); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use CultuurNet\UDB3\BookingInfo; | ||
use CultuurNet\UDB3\DateTimeFactory; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Translation\Language; | ||
use CultuurNet\UDB3\Model\ValueObject\Web\EmailAddress; | ||
|
@@ -40,8 +41,10 @@ public function setUp(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
); | ||
|
||
$this->updateBookingInfo = $this->getMockForAbstractClass( | ||
|
@@ -66,8 +69,10 @@ public function it_can_return_its_properties(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
); | ||
|
||
$this->assertEquals($expectedBookingInfo, $bookingInfo); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use CultuurNet\UDB3\BookingInfo; | ||
use CultuurNet\UDB3\DateTimeFactory; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\BookingAvailability; | ||
use CultuurNet\UDB3\Model\ValueObject\Contact\TelephoneNumber; | ||
use CultuurNet\UDB3\Model\ValueObject\Translation\Language; | ||
use CultuurNet\UDB3\Model\ValueObject\Web\EmailAddress; | ||
|
@@ -39,8 +40,10 @@ public function setUp(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
); | ||
$this->abstractBookingInfoEvent = new MockAbstractBookingInfoEvent( | ||
$this->itemId, | ||
|
@@ -64,8 +67,10 @@ public function it_can_be_instantiated_with_properties(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
); | ||
$expectedAbstractBookingInfoEvent = new MockAbstractBookingInfoEvent( | ||
$expectedItemId, | ||
|
@@ -91,8 +96,10 @@ public function it_can_return_its_properties(): void | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
); | ||
|
||
$itemId = $this->abstractBookingInfoEvent->getItemId(); | ||
|
@@ -157,8 +164,10 @@ public function serializationDataProvider(): array | |
), | ||
new TelephoneNumber('0123456789'), | ||
new EmailAddress('[email protected]'), | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
BookingAvailability::fromTo( | ||
DateTimeFactory::fromAtom('2016-01-01T00:00:00+01:00'), | ||
DateTimeFactory::fromAtom('2016-01-31T00:00:00+01:00') | ||
) | ||
) | ||
), | ||
], | ||
|
Oops, something went wrong.