From 46f834c9bf7ff890700cef3b05fd2d7ebefb21a0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 17 Jul 2020 13:42:45 +0400 Subject: Updated channel entity Signed-off-by: Valentin Popov --- src/Entities/ChannelEntity.php | 11 +++++++++++ tests/Entities/ChannelEntityTest.php | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/Entities/ChannelEntity.php b/src/Entities/ChannelEntity.php index 59fc8ce..0d8d3fc 100644 --- a/src/Entities/ChannelEntity.php +++ b/src/Entities/ChannelEntity.php @@ -24,6 +24,7 @@ use function is_string; /** * @property-read string $base_id + * @property-read string $base_name * @property-read string $epg_id * @property-read string $geo_data * @property-read string $href @@ -44,6 +45,11 @@ final class ChannelEntity { */ private string $base_id; + /** + * @var string + */ + private string $base_name; + /** * @var string */ @@ -94,6 +100,7 @@ final class ChannelEntity { */ private function __construct(array $payload) { $this->base_id = $payload['base_id']; + $this->base_name = $payload['base_name']; $this->epg_id = $payload['epg_id']; $this->geo_data = $payload['geo_data']; $this->href = $payload['href']; @@ -117,6 +124,10 @@ final class ChannelEntity { throw new RuntimeException('blah-blah-blah'); } + if (!is_string($payload['base_name'])) { + throw new RuntimeException('blah-blah-blah'); + } + if (!is_string($payload['epg_id'])) { throw new RuntimeException('blah-blah-blah'); } diff --git a/tests/Entities/ChannelEntityTest.php b/tests/Entities/ChannelEntityTest.php index e4f2456..e3c2733 100644 --- a/tests/Entities/ChannelEntityTest.php +++ b/tests/Entities/ChannelEntityTest.php @@ -33,6 +33,7 @@ final class ChannelEntityTest extends TestCase { $faker = Factory::create(); $base_id = $faker->unique()->sha256; + $base_name = $faker->unique()->sha256; $epg_id = $faker->unique()->sha256; $geo_data = $faker->unique()->sha256; $href = $faker->unique()->sha256; @@ -45,6 +46,7 @@ final class ChannelEntityTest extends TestCase { $entity = ChannelEntity::create(compact( 'base_id', + 'base_name', 'epg_id', 'geo_data', 'href', @@ -57,6 +59,7 @@ final class ChannelEntityTest extends TestCase { )); self::assertEquals($base_id, $entity->base_id); + self::assertEquals($base_name, $entity->base_name); self::assertEquals($epg_id, $entity->epg_id); self::assertEquals($geo_data, $entity->geo_data); self::assertEquals($href, $entity->href); -- cgit v1.2.3