From f005c33e49e7586bd811a78e4318bec1ef9f732d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Glawaty?= Date: Thu, 17 Oct 2024 02:56:36 +0200 Subject: [PATCH] Added integration of the new fields `close_expiration` into Position and Banner entities and also into the `data-amp-banner-external` and `data-amp-banner-fingerprint` attributes --- CHANGELOG.md | 2 ++ README.md | 1 + src/Renderer/AmpBannerExternalAttribute.php | 1 + src/Renderer/Fingerprint.php | 1 + .../BannersResponseHydratorHandler.php | 4 +++ src/Response/ValueObject/Banner.php | 9 ++++++ src/Response/ValueObject/Position.php | 9 ++++++ tests/Bridge/Latte/RendererProviderTest.php | 15 ++++++++++ tests/Renderer/BannersResolverTest.php | 30 +++++++++++-------- .../BreakpointStyle/BreakpointStyleTest.php | 2 ++ tests/Renderer/RendererTest.php | 14 ++++++--- .../renderer/multiple/data-provider.php | 13 ++++---- .../multiple/multipleBannersFullFeatured.html | 6 ++-- ...leBannersFullFeatured.withLazyLoading.html | 6 ++-- ...llFeatured.withLazyLoadingFromOffset1.html | 6 ++-- ...BannersFullFeatured.withoutDimensions.html | 6 ++-- .../multipleBannersWithoutContents.html | 2 +- .../resources/renderer/multiple/noBanner.html | 2 +- .../multiple/noBanner.withAttributes.html | 2 +- .../multiple/singleBannerWithoutContents.html | 2 +- .../renderer/not-found/data-provider.php | 1 + .../renderer/not-found/notFound.html | 2 +- .../not-found/notFound.withAttributes.html | 2 +- .../not-found/notFound.withLazyLoading.html | 2 +- .../bannerWithBreakpointHtmlContentOnly.html | 4 +-- .../bannerWithBreakpointImageContentOnly.html | 4 +-- .../bannerWithDefaultHtmlContentOnly.html | 4 +-- ...faultImageContentOnly.withLazyLoading.html | 4 +-- ...ltImageContentOnly.withOptionalValues.html | 4 +-- ...ultImageContentOnly.withoutDimensions.html | 4 +-- ...mageContentOnly.withoutOptionalValues.html | 4 +-- .../random/bannerWithMultipleContents.html | 4 +-- .../renderer/random/bannerWithoutContent.html | 2 +- .../renderer/random/data-provider.php | 19 ++++++------ tests/resources/renderer/random/noBanner.html | 2 +- .../random/noBanner.withAttributes.html | 2 +- .../bannerWithBreakpointHtmlContentOnly.html | 4 +-- .../bannerWithBreakpointImageContentOnly.html | 4 +-- .../bannerWithDefaultHtmlContentOnly.html | 4 +-- ...faultImageContentOnly.withLazyLoading.html | 4 +-- ...ltImageContentOnly.withOptionalValues.html | 4 +-- ...ultImageContentOnly.withoutDimensions.html | 4 +-- ...mageContentOnly.withoutOptionalValues.html | 4 +-- .../single/bannerWithMultipleContents.html | 4 +-- .../renderer/single/bannerWithoutContent.html | 2 +- .../renderer/single/data-provider.php | 19 ++++++------ tests/resources/renderer/single/noBanner.html | 2 +- .../single/noBanner.withAttributes.html | 2 +- .../response-body/fetch-banners.full.json | 13 ++++++++ .../response-body/fetch-banners.full.php | 11 ++++++- 50 files changed, 180 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a6f46b..302ece4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Added integration of the new fields `close_expiration` into Position and Banner entities and also into the `data-amp-banner-external` and `data-amp-banner-fingerprint` attributes. ## [1.3.1] - 2024-10-11 ### Added diff --git a/README.md b/README.md index a683774..61dc84e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ $ composer require 68publishers/amp-client | `~1.1.0` | `~1.4.0` | `2.12.0` | `1` | | `~1.2.0` | `~1.5.0` | `>=2.13.0 <= 2.15.1` | `1` | | `~1.3.0` | `~1.6.0` | `>=2.16.0` | `1` | +| `~1.4.0` | `~1.7.0` | `>=2.17.0` | `1` | ## Integration without a framework diff --git a/src/Renderer/AmpBannerExternalAttribute.php b/src/Renderer/AmpBannerExternalAttribute.php index eb4573a..ac4b923 100644 --- a/src/Renderer/AmpBannerExternalAttribute.php +++ b/src/Renderer/AmpBannerExternalAttribute.php @@ -43,6 +43,7 @@ public function __toString(): string 'rotationSeconds' => $this->position->getRotationSeconds(), 'displayType' => $this->position->getDisplayType(), 'breakpointType' => $this->position->getBreakpointType(), + 'closeExpiration' => $this->position->getCloseExpiration(), ], 'state' => [ 'value' => $this->state, diff --git a/src/Renderer/Fingerprint.php b/src/Renderer/Fingerprint.php index 9d4b7db..d85e739 100644 --- a/src/Renderer/Fingerprint.php +++ b/src/Renderer/Fingerprint.php @@ -35,6 +35,7 @@ public static function create(Position $position, Banner $banner): self 'campaignId' => $banner->getCampaignId(), 'campaignCode' => $banner->getCampaignCode(), 'campaignName' => $banner->getCampaignName(), + 'closeExpiration' => $banner->getCloseExpiration(), ]; try { diff --git a/src/Response/Hydrator/BannersResponseHydratorHandler.php b/src/Response/Hydrator/BannersResponseHydratorHandler.php index 9e07948..d1ac650 100644 --- a/src/Response/Hydrator/BannersResponseHydratorHandler.php +++ b/src/Response/Hydrator/BannersResponseHydratorHandler.php @@ -45,6 +45,7 @@ * campaign_id: string|null, * campaign_code: string|null, * campaign_name: string|null, + * close_expiration: int|null, * contents: array, * } * @@ -60,6 +61,7 @@ * display_type: string|null, * breakpoint_type: string, * mode?: string, + * close_expiration?: int|null, * options?: array, * banners: array, * } @@ -93,6 +95,7 @@ public function hydrate($responseBody): BannersResponse $positionData['display_type'] ?? null, $positionData['breakpoint_type'], $positionData['mode'] ?? Position::ModeManaged, + $positionData['close_expiration'] ?? null, $positionData['options'] ?? [], $this->hydrateBanners($positionData['banners']), ); @@ -118,6 +121,7 @@ private function hydrateBanners(array $bannersData): array $bannerData['campaign_id'], $bannerData['campaign_code'], $bannerData['campaign_name'], + $bannerData['close_expiration'] ?? null, $this->hydrateContents($bannerData['contents']), ); } diff --git a/src/Response/ValueObject/Banner.php b/src/Response/ValueObject/Banner.php index 22a110e..0cafd61 100644 --- a/src/Response/ValueObject/Banner.php +++ b/src/Response/ValueObject/Banner.php @@ -19,6 +19,8 @@ final class Banner private ?string $campaignName; + private ?int $closeExpiration; + /** @var array */ private array $contents; @@ -33,6 +35,7 @@ public function __construct( ?string $campaignId, ?string $campaignCode, ?string $campaignName, + ?int $closeExpiration, array $contents ) { $this->id = $id; @@ -41,6 +44,7 @@ public function __construct( $this->campaignId = $campaignId; $this->campaignCode = $campaignCode; $this->campaignName = $campaignName; + $this->closeExpiration = $closeExpiration; $this->contents = $contents; } @@ -77,6 +81,11 @@ public function getCampaignName(): ?string return $this->campaignName; } + public function getCloseExpiration(): ?int + { + return $this->closeExpiration; + } + /** * @return array */ diff --git a/src/Response/ValueObject/Position.php b/src/Response/ValueObject/Position.php index d5d9cc8..20406b0 100644 --- a/src/Response/ValueObject/Position.php +++ b/src/Response/ValueObject/Position.php @@ -30,6 +30,8 @@ final class Position private string $mode; + private ?int $closeExpiration; + /** @var array */ private array $options; @@ -48,6 +50,7 @@ public function __construct( ?string $displayType, string $breakpointType, string $mode, + ?int $closeExpiration, array $options, array $banners ) { @@ -58,6 +61,7 @@ public function __construct( $this->displayType = $displayType; $this->breakpointType = $breakpointType; $this->mode = $mode; + $this->closeExpiration = $closeExpiration; $this->options = $options; $this->banners = $banners; } @@ -97,6 +101,11 @@ public function getMode(): string return $this->mode; } + public function getCloseExpiration(): ?int + { + return $this->closeExpiration; + } + /** * @return array */ diff --git a/tests/Bridge/Latte/RendererProviderTest.php b/tests/Bridge/Latte/RendererProviderTest.php index 9e5ba37..310d8d5 100644 --- a/tests/Bridge/Latte/RendererProviderTest.php +++ b/tests/Bridge/Latte/RendererProviderTest.php @@ -45,6 +45,7 @@ public function testInvokingDefaultInstanceWithoutResources(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -90,6 +91,7 @@ public function testInvokingDefaultInstanceWithSameModeAsDefault(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -135,6 +137,7 @@ public function testInvokingDefaultInstanceWithAttributes(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -180,6 +183,7 @@ public function testInvokingDefaultInstanceWithOptions(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -225,6 +229,7 @@ public function testInvokingDefaultInstanceWithResources(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -286,6 +291,7 @@ public function testInvokingDefaultInstanceWithPositionInEmbedMode(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, $positionMode, + null, [], [], ); @@ -332,6 +338,7 @@ public function testClientConfigurationEventsShouldBeInvokedBeforeFirstFetch(): ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -452,6 +459,7 @@ public function testExceptionShouldBeThrownWhenRendererThrowsExceptionInDebugMod ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -491,6 +499,7 @@ public function testEmptyStringShouldBeReturnedWhenRendererThrowsExceptionInNonD ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -528,6 +537,7 @@ public function testExceptionShouldBeLoggedWhenRendererThrowsExceptionInNonDebug ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -615,6 +625,7 @@ public function testPositionsShouldBeQueuedAndReplacedInStringOutput(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -626,6 +637,7 @@ public function testPositionsShouldBeQueuedAndReplacedInStringOutput(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -727,6 +739,7 @@ public function testPositionsShouldBeQueuedAndReplacedInArrayOutput(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -738,6 +751,7 @@ public function testPositionsShouldBeQueuedAndReplacedInArrayOutput(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -829,6 +843,7 @@ public function testEmbedPositionReturnedFromApiShouldBeQueuedAndReplacedInStrin ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeEmbed, + null, [], [], ); diff --git a/tests/Renderer/BannersResolverTest.php b/tests/Renderer/BannersResolverTest.php index 5645a55..0daf20a 100644 --- a/tests/Renderer/BannersResolverTest.php +++ b/tests/Renderer/BannersResolverTest.php @@ -24,6 +24,7 @@ public function testNullShouldBeReturnedWhenResolvingSinglePositionWithoutBanner Position::DisplayTypeSingle, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [], ); @@ -34,10 +35,10 @@ public function testNullShouldBeReturnedWhenResolvingSinglePositionWithoutBanner public function testFirstBannerWithHighestScoreShouldBeReturnedWhenResolvingSinglePosition(): void { - $banner1 = new Banner('1', '1', 0, null, null, null, []); - $banner2 = new Banner('2', '2', 2, null, null, null, []); - $banner3 = new Banner('3', '3', 1, null, null, null, []); - $banner4 = new Banner('4', '4', 2, null, null, null, []); + $banner1 = new Banner('1', '1', 0, null, null, null, null, []); + $banner2 = new Banner('2', '2', 2, null, null, null, null, []); + $banner3 = new Banner('3', '3', 1, null, null, null, null, []); + $banner4 = new Banner('4', '4', 2, null, null, null, null, []); $position = new Position( '1234', 'homepage.top', @@ -46,6 +47,7 @@ public function testFirstBannerWithHighestScoreShouldBeReturnedWhenResolvingSing Position::DisplayTypeSingle, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [$banner1, $banner2, $banner3, $banner4], ); @@ -64,6 +66,7 @@ public function testEmptyArrayShouldBeReturnedWhenResolvingMultiplePositionWitho Position::DisplayTypeMultiple, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [], ); @@ -74,10 +77,10 @@ public function testEmptyArrayShouldBeReturnedWhenResolvingMultiplePositionWitho public function testSortedBannersShouldBeReturnedWhenResolvingMultiplePosition(): void { - $banner1 = new Banner('1', '1', 0, null, null, null, []); - $banner2 = new Banner('2', '2', 2, null, null, null, []); - $banner3 = new Banner('3', '3', 1, null, null, null, []); - $banner4 = new Banner('4', '4', 2, null, null, null, []); + $banner1 = new Banner('1', '1', 0, null, null, null, null, []); + $banner2 = new Banner('2', '2', 2, null, null, null, null, []); + $banner3 = new Banner('3', '3', 1, null, null, null, null, []); + $banner4 = new Banner('4', '4', 2, null, null, null, null, []); $position = new Position( '1234', 'homepage.top', @@ -86,6 +89,7 @@ public function testSortedBannersShouldBeReturnedWhenResolvingMultiplePosition() Position::DisplayTypeMultiple, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [$banner1, $banner2, $banner3, $banner4], ); @@ -109,6 +113,7 @@ public function testNullShouldBeReturnedWhenResolvingRandomPositionWithoutBanner Position::DisplayTypeRandom, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [], ); @@ -119,10 +124,10 @@ public function testNullShouldBeReturnedWhenResolvingRandomPositionWithoutBanner public function testRandomBannerShouldBeReturnedWhenResolvingRandomPosition(): void { - $banner1 = new Banner('1', '1', 1, null, null, null, []); - $banner2 = new Banner('2', '2', 3, null, null, null, []); - $banner3 = new Banner('3', '3', 2, null, null, null, []); - $banner4 = new Banner('4', '4', 3, null, null, null, []); + $banner1 = new Banner('1', '1', 1, null, null, null, null, []); + $banner2 = new Banner('2', '2', 3, null, null, null, null, []); + $banner3 = new Banner('3', '3', 2, null, null, null, null, []); + $banner4 = new Banner('4', '4', 3, null, null, null, null, []); $position = new Position( '1234', 'homepage.top', @@ -131,6 +136,7 @@ public function testRandomBannerShouldBeReturnedWhenResolvingRandomPosition(): v Position::DisplayTypeRandom, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [$banner1, $banner2, $banner3, $banner4], ); diff --git a/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php b/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php index 838fe65..26860ee 100644 --- a/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php +++ b/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php @@ -121,6 +121,7 @@ private function createBreakpointStyle(string $breakpointType, array $contents): null, null, null, + null, $contents, ); @@ -132,6 +133,7 @@ private function createBreakpointStyle(string $breakpointType, array $contents): Position::DisplayTypeSingle, $breakpointType, ResponsePosition::ModeManaged, + null, [], [$banner], ); diff --git a/tests/Renderer/RendererTest.php b/tests/Renderer/RendererTest.php index 3722b0f..88299fa 100644 --- a/tests/Renderer/RendererTest.php +++ b/tests/Renderer/RendererTest.php @@ -62,6 +62,7 @@ public function testNotFoundTemplateShouldBeRendered(): void null, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -84,7 +85,7 @@ public function testSingleTemplateShouldBeRendered(): void $expressionParser = Mockery::mock(ExpressionParserInterface::class); $renderer = new Renderer($bannersResolver, $rendererBridge, $expressionParser); - $banner = new Banner('1234', 'Main', 0, null, null, null, []); + $banner = new Banner('1234', 'Main', 0, null, null, null, null, []); $position = new ResponsePosition( '1234', 'homepage.top', @@ -93,6 +94,7 @@ public function testSingleTemplateShouldBeRendered(): void ResponsePosition::DisplayTypeSingle, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [$banner], ); @@ -121,7 +123,7 @@ public function testRandomTemplateShouldBeRendered(): void $expressionParser = Mockery::mock(ExpressionParserInterface::class); $renderer = new Renderer($bannersResolver, $rendererBridge, $expressionParser); - $banner = new Banner('1234', 'Main', 0, null, null, null, []); + $banner = new Banner('1234', 'Main', 0, null, null, null, null, []); $position = new ResponsePosition( '1234', 'homepage.top', @@ -130,6 +132,7 @@ public function testRandomTemplateShouldBeRendered(): void ResponsePosition::DisplayTypeRandom, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [$banner], ); @@ -159,8 +162,8 @@ public function testMultipleTemplateShouldBeRendered(): void $renderer = new Renderer($bannersResolver, $rendererBridge, $expressionParser); $banners = [ - new Banner('1234', 'Main', 0, null, null, null, []), - new Banner('1235', 'Secondary', 0, null, null, null, []), + new Banner('1234', 'Main', 0, null, null, null, null, []), + new Banner('1235', 'Secondary', 0, null, null, null, null, []), ]; $position = new ResponsePosition( '1234', @@ -170,6 +173,7 @@ public function testMultipleTemplateShouldBeRendered(): void ResponsePosition::DisplayTypeMultiple, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [ 'fetchpriority' => '0:high,low', ], @@ -252,6 +256,7 @@ public function testRendererExceptionShouldBeThrownOnRenderingWhenBridgeThrowsTh null, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -310,6 +315,7 @@ public function testRendererExceptionShouldBeThrownOnRenderingWhenBridgeThrowsAn null, ResponsePosition::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); diff --git a/tests/resources/renderer/multiple/data-provider.php b/tests/resources/renderer/multiple/data-provider.php index 8c4cd98..0b2a42e 100644 --- a/tests/resources/renderer/multiple/data-provider.php +++ b/tests/resources/renderer/multiple/data-provider.php @@ -18,13 +18,14 @@ Position::DisplayTypeMultiple, Position::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); $createFullFeaturedBanners = function (bool $withDimensions): array { return [ - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( null, '

Small content

', @@ -60,7 +61,7 @@ $withDimensions ? new Dimensions(600, 300) : new Dimensions(null, null), ), ]), - new Banner('1235', 'Secondary', 0, null, null, null, [ + new Banner('1235', 'Secondary', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/secondary1', @@ -74,7 +75,7 @@ $withDimensions ? new Dimensions(1000, 300) : new Dimensions(null, null), ), ]), - new Banner('1236', 'No contents', 0, null, null, null, []), + new Banner('1236', 'No contents', 0, null, null, null, null, []), ]; }; @@ -101,7 +102,7 @@ 'Single banner without contents' => [ $position, [ - new Banner('1234', 'Main', 0, null, null, null, []), + new Banner('1234', 'Main', 0, null, null, null, null, []), ], [], [], @@ -110,8 +111,8 @@ 'Multiple banners without contents' => [ $position, [ - new Banner('1234', 'Main 1', 0, null, null, null, []), - new Banner('1235', 'Main 2', 0, null, null, null, []), + new Banner('1234', 'Main 1', 0, null, null, null, null, []), + new Banner('1235', 'Main 2', 0, null, null, null, null, []), ], [], [], diff --git a/tests/resources/renderer/multiple/multipleBannersFullFeatured.html b/tests/resources/renderer/multiple/multipleBannersFullFeatured.html index ae5f381..6c3ec8d 100644 --- a/tests/resources/renderer/multiple/multipleBannersFullFeatured.html +++ b/tests/resources/renderer/multiple/multipleBannersFullFeatured.html @@ -1,7 +1,7 @@ -
+
-
+

Small content

@@ -21,7 +21,7 @@
-
+
Secondary 1 diff --git a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoading.html b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoading.html index 791e233..d4feb60 100644 --- a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoading.html +++ b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoading.html @@ -1,7 +1,7 @@ -
+
-
+

Small content

@@ -21,7 +21,7 @@
-
+
Secondary 1 diff --git a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoadingFromOffset1.html b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoadingFromOffset1.html index ba10a89..44039f2 100644 --- a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoadingFromOffset1.html +++ b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withLazyLoadingFromOffset1.html @@ -1,7 +1,7 @@ -
+
-
+

Small content

@@ -21,7 +21,7 @@
-
+
Secondary 1 diff --git a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withoutDimensions.html b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withoutDimensions.html index e094660..a33abf5 100644 --- a/tests/resources/renderer/multiple/multipleBannersFullFeatured.withoutDimensions.html +++ b/tests/resources/renderer/multiple/multipleBannersFullFeatured.withoutDimensions.html @@ -1,7 +1,7 @@ -
+
-
+

Small content

@@ -21,7 +21,7 @@
-
+
Secondary 1 diff --git a/tests/resources/renderer/multiple/multipleBannersWithoutContents.html b/tests/resources/renderer/multiple/multipleBannersWithoutContents.html index bd98e88..9973a0c 100644 --- a/tests/resources/renderer/multiple/multipleBannersWithoutContents.html +++ b/tests/resources/renderer/multiple/multipleBannersWithoutContents.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/multiple/noBanner.html b/tests/resources/renderer/multiple/noBanner.html index bd98e88..9973a0c 100644 --- a/tests/resources/renderer/multiple/noBanner.html +++ b/tests/resources/renderer/multiple/noBanner.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/multiple/noBanner.withAttributes.html b/tests/resources/renderer/multiple/noBanner.withAttributes.html index 14405ff..35fdce0 100644 --- a/tests/resources/renderer/multiple/noBanner.withAttributes.html +++ b/tests/resources/renderer/multiple/noBanner.withAttributes.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/multiple/singleBannerWithoutContents.html b/tests/resources/renderer/multiple/singleBannerWithoutContents.html index bd98e88..9973a0c 100644 --- a/tests/resources/renderer/multiple/singleBannerWithoutContents.html +++ b/tests/resources/renderer/multiple/singleBannerWithoutContents.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/not-found/data-provider.php b/tests/resources/renderer/not-found/data-provider.php index 63f202a..47215d9 100644 --- a/tests/resources/renderer/not-found/data-provider.php +++ b/tests/resources/renderer/not-found/data-provider.php @@ -13,6 +13,7 @@ null, Position::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); diff --git a/tests/resources/renderer/not-found/notFound.html b/tests/resources/renderer/not-found/notFound.html index cada5f2..f3844fb 100644 --- a/tests/resources/renderer/not-found/notFound.html +++ b/tests/resources/renderer/not-found/notFound.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/not-found/notFound.withAttributes.html b/tests/resources/renderer/not-found/notFound.withAttributes.html index 56bfbc2..8bb904c 100644 --- a/tests/resources/renderer/not-found/notFound.withAttributes.html +++ b/tests/resources/renderer/not-found/notFound.withAttributes.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/not-found/notFound.withLazyLoading.html b/tests/resources/renderer/not-found/notFound.withLazyLoading.html index 983f275..c4dc56e 100644 --- a/tests/resources/renderer/not-found/notFound.withLazyLoading.html +++ b/tests/resources/renderer/not-found/notFound.withLazyLoading.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html b/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html index e87e59b..7742813 100644 --- a/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html +++ b/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+

My Awesome content!

diff --git a/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html b/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html index a52ab23..b6886fd 100644 --- a/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html +++ b/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+
Main 1 diff --git a/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html b/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html index f741561..599d23e 100644 --- a/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html +++ b/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+

My Awesome content!

diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withLazyLoading.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withLazyLoading.html index 3663df9..5f5a8da 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withLazyLoading.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withLazyLoading.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html index 1ddbe60..dd4d945 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutDimensions.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutDimensions.html index 4661727..46fe024 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutDimensions.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutDimensions.html @@ -1,5 +1,5 @@ -
-
+
+
Main 1 diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html index 2afd05c..a6f259b 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html @@ -1,5 +1,5 @@ -
-
+
+
Main 1 diff --git a/tests/resources/renderer/random/bannerWithMultipleContents.html b/tests/resources/renderer/random/bannerWithMultipleContents.html index d28bdda..0a9a8a7 100644 --- a/tests/resources/renderer/random/bannerWithMultipleContents.html +++ b/tests/resources/renderer/random/bannerWithMultipleContents.html @@ -1,5 +1,5 @@ -
-
+
+

Small content

diff --git a/tests/resources/renderer/random/bannerWithoutContent.html b/tests/resources/renderer/random/bannerWithoutContent.html index 08aef83..c49bd5d 100644 --- a/tests/resources/renderer/random/bannerWithoutContent.html +++ b/tests/resources/renderer/random/bannerWithoutContent.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/random/data-provider.php b/tests/resources/renderer/random/data-provider.php index fea8ee3..3fa71c4 100644 --- a/tests/resources/renderer/random/data-provider.php +++ b/tests/resources/renderer/random/data-provider.php @@ -18,6 +18,7 @@ Position::DisplayTypeRandom, Position::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -44,14 +45,14 @@ ], 'Banner without contents' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, []), + new Banner('1234', 'Main', 0, null, null, null, null, []), [], [], __DIR__ . '/bannerWithoutContent.html', ], 'Banner with default content only: image without optional values' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -71,7 +72,7 @@ ], 'Banner with default content only: image without dimensions' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -91,7 +92,7 @@ ], 'Banner with default content only: image with optional value' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -114,7 +115,7 @@ ], 'Banner with default content only: image with lazy loading' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -139,7 +140,7 @@ ], 'Banner with breakpoint content only: image' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( 500, 'https://www.example.com/main1', @@ -159,7 +160,7 @@ ], 'Banner with default content only: html' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( null, '

My Awesome content!

', @@ -171,7 +172,7 @@ ], 'Banner with breakpoint content only: html' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( 500, '

My Awesome content!

', @@ -183,7 +184,7 @@ ], 'Banner with multiple contents' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( null, '

Small content

', diff --git a/tests/resources/renderer/random/noBanner.html b/tests/resources/renderer/random/noBanner.html index 08aef83..c49bd5d 100644 --- a/tests/resources/renderer/random/noBanner.html +++ b/tests/resources/renderer/random/noBanner.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/random/noBanner.withAttributes.html b/tests/resources/renderer/random/noBanner.withAttributes.html index 7fd0cf0..d6845d8 100644 --- a/tests/resources/renderer/random/noBanner.withAttributes.html +++ b/tests/resources/renderer/random/noBanner.withAttributes.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html b/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html index 0359246..6e988c8 100644 --- a/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html +++ b/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+

My Awesome content!

diff --git a/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html b/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html index dbbdc43..aba66bc 100644 --- a/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html +++ b/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+
Main 1 diff --git a/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html b/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html index e178c4c..486a8ad 100644 --- a/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html +++ b/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html @@ -1,5 +1,5 @@ -
-
+
+

My Awesome content!

diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withLazyLoading.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withLazyLoading.html index a506fa4..4e460ac 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withLazyLoading.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withLazyLoading.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html index 4fd1da5..8c59d37 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutDimensions.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutDimensions.html index ee3460b..35e6b47 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutDimensions.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutDimensions.html @@ -1,7 +1,7 @@
+ data-amp-banner-external="JTdCJTIycG9zaXRpb25EYXRhJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIxMjM0JTIyJTJDJTIyY29kZSUyMiUzQSUyMmhvbWVwYWdlLnRvcCUyMiUyQyUyMm5hbWUlMjIlM0ElMjJIb21lcGFnZSUyMHRvcCUyMiUyQyUyMnJvdGF0aW9uU2Vjb25kcyUyMiUzQTAlMkMlMjJkaXNwbGF5VHlwZSUyMiUzQSUyMnNpbmdsZSUyMiUyQyUyMmJyZWFrcG9pbnRUeXBlJTIyJTNBJTIybWluJTIyJTJDJTIyY2xvc2VFeHBpcmF0aW9uJTIyJTNBbnVsbCU3RCUyQyUyMnN0YXRlJTIyJTNBJTdCJTIydmFsdWUlMjIlM0ElMjJSRU5ERVJFRCUyMiUyQyUyMmluZm8lMjIlM0ElMjJCYW5uZXIlMjB3YXMlMjBzdWNjZXNzZnVsbHklMjByZW5kZXJlZCUyMHNlcnZlci1zaWRlLiUyMiU3RCU3RA==">
diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html index 5cdac58..99f4c23 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html @@ -1,5 +1,5 @@ -
-
+
+
Main 1 diff --git a/tests/resources/renderer/single/bannerWithMultipleContents.html b/tests/resources/renderer/single/bannerWithMultipleContents.html index b98476c..76e333c 100644 --- a/tests/resources/renderer/single/bannerWithMultipleContents.html +++ b/tests/resources/renderer/single/bannerWithMultipleContents.html @@ -1,5 +1,5 @@ -
-
+
+

Small content

diff --git a/tests/resources/renderer/single/bannerWithoutContent.html b/tests/resources/renderer/single/bannerWithoutContent.html index 170c63b..398a7d1 100644 --- a/tests/resources/renderer/single/bannerWithoutContent.html +++ b/tests/resources/renderer/single/bannerWithoutContent.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/single/data-provider.php b/tests/resources/renderer/single/data-provider.php index 0ef58dc..a7d7d2d 100644 --- a/tests/resources/renderer/single/data-provider.php +++ b/tests/resources/renderer/single/data-provider.php @@ -18,6 +18,7 @@ Position::DisplayTypeSingle, Position::BreakpointTypeMin, ResponsePosition::ModeManaged, + null, [], [], ); @@ -44,14 +45,14 @@ ], 'Banner without contents' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, []), + new Banner('1234', 'Main', 0, null, null, null, null, []), [], [], __DIR__ . '/bannerWithoutContent.html', ], 'Banner with default content only: image without optional values' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -71,7 +72,7 @@ ], 'Banner with default content only: image without dimensions' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -91,7 +92,7 @@ ], 'Banner with default content only: image with optional value' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -114,7 +115,7 @@ ], 'Banner with default content only: image with lazy loading' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( null, 'https://www.example.com/main1', @@ -139,7 +140,7 @@ ], 'Banner with breakpoint content only: image' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new ImageContent( 500, 'https://www.example.com/main1', @@ -159,7 +160,7 @@ ], 'Banner with default content only: html' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( null, '

My Awesome content!

', @@ -171,7 +172,7 @@ ], 'Banner with breakpoint content only: html' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( 500, '

My Awesome content!

', @@ -183,7 +184,7 @@ ], 'Banner with multiple contents' => [ $position, - new Banner('1234', 'Main', 0, null, null, null, [ + new Banner('1234', 'Main', 0, null, null, null, null, [ new HtmlContent( null, '

Small content

', diff --git a/tests/resources/renderer/single/noBanner.html b/tests/resources/renderer/single/noBanner.html index 170c63b..398a7d1 100644 --- a/tests/resources/renderer/single/noBanner.html +++ b/tests/resources/renderer/single/noBanner.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/renderer/single/noBanner.withAttributes.html b/tests/resources/renderer/single/noBanner.withAttributes.html index 16cfa77..c24745b 100644 --- a/tests/resources/renderer/single/noBanner.withAttributes.html +++ b/tests/resources/renderer/single/noBanner.withAttributes.html @@ -1 +1 @@ -
+
diff --git a/tests/resources/response-body/fetch-banners.full.json b/tests/resources/response-body/fetch-banners.full.json index 28a0531..f327302 100644 --- a/tests/resources/response-body/fetch-banners.full.json +++ b/tests/resources/response-body/fetch-banners.full.json @@ -8,6 +8,10 @@ "display_type": "multiple", "breakpoint_type": "min", "mode": "managed", + "close_expiration": null, + "options": { + "loading": ">=1:lazy" + }, "banners": [ { "id": "d7275445-c287-47d2-b71a-3baff5b4d23c", @@ -16,6 +20,7 @@ "campaign_id": null, "campaign_code": null, "campaign_name": null, + "close_expiration": 86400, "contents": [ { "breakpoint": null, @@ -47,6 +52,7 @@ "campaign_id": "a6c98208-b707-46c2-80c3-8f3753a522b8", "campaign_code": "test-campaign", "campaign_name": "Test campaign", + "close_expiration": 86400, "contents": [ { "breakpoint": null, @@ -80,6 +86,8 @@ "display_type": "random", "breakpoint_type": "min", "mode": "managed", + "close_expiration": 3600, + "options": {}, "banners": [] }, "homepage.missing": { @@ -89,6 +97,8 @@ "display_type": null, "breakpoint_type": "min", "mode": "managed", + "close_expiration": null, + "options": {}, "banners": [] }, "homepage.bottom": { @@ -98,6 +108,8 @@ "display_type": "single", "breakpoint_type": "min", "mode": "managed", + "close_expiration": 3600, + "options": {}, "banners": [ { "id": "54c72f46-2b6c-4d80-a75e-28fed4d79f5c", @@ -106,6 +118,7 @@ "campaign_id": "a6c98208-b707-46c2-80c3-8f3753a522b8", "campaign_code": "test-campaign", "campaign_name": "Test campaign", + "close_expiration": 86400, "contents": [ { "breakpoint": null, diff --git a/tests/resources/response-body/fetch-banners.full.php b/tests/resources/response-body/fetch-banners.full.php index 1c57d8c..629aac5 100644 --- a/tests/resources/response-body/fetch-banners.full.php +++ b/tests/resources/response-body/fetch-banners.full.php @@ -19,7 +19,10 @@ Position::DisplayTypeMultiple, Position::BreakpointTypeMin, Position::ModeManaged, - [], + null, + [ + 'loading' => '>=1:lazy', + ], [ new Banner( 'd7275445-c287-47d2-b71a-3baff5b4d23c', @@ -28,6 +31,7 @@ null, null, null, + 86400, [ new ImageContent( null, @@ -58,6 +62,7 @@ 'a6c98208-b707-46c2-80c3-8f3753a522b8', 'test-campaign', 'Test campaign', + 86400, [ new ImageContent( null, @@ -91,6 +96,7 @@ Position::DisplayTypeRandom, Position::BreakpointTypeMin, Position::ModeManaged, + 3600, [], [], ), @@ -102,6 +108,7 @@ null, Position::BreakpointTypeMin, Position::ModeManaged, + null, [], [], ), @@ -113,6 +120,7 @@ Position::DisplayTypeSingle, Position::BreakpointTypeMin, Position::ModeManaged, + 3600, [], [ new Banner( @@ -122,6 +130,7 @@ 'a6c98208-b707-46c2-80c3-8f3753a522b8', 'test-campaign', 'Test campaign', + 86400, [ new ImageContent( null,