From 7ae48a10a2abcc8cb27c37ae75735795cdb8715a Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Fri, 4 Oct 2019 10:39:47 +0100 Subject: [PATCH 1/2] Add Youtube Channel Faker --- src/Youtube.php | 5 +++++ tests/Faker/YoutubeTest.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Youtube.php b/src/Youtube.php index af537ff..930ecf3 100644 --- a/src/Youtube.php +++ b/src/Youtube.php @@ -36,6 +36,11 @@ public function youtubeEmbedCode() . ' allowfullscreen>'; } + public function youtubeChannelUri() + { + return 'https://www.youtube.com/channel/' . $this->regexify(sprintf('[a-zA-Z0-9\-]{1,%s}', $this->numberBetween(1, 20))); + } + public function youtubeRandomUri() { switch ($this->numberBetween(1,3)) { diff --git a/tests/Faker/YoutubeTest.php b/tests/Faker/YoutubeTest.php index 1fc4a28..a202ee3 100644 --- a/tests/Faker/YoutubeTest.php +++ b/tests/Faker/YoutubeTest.php @@ -37,6 +37,11 @@ public function testYoutubeEmbedUri() $this->assertRegExp('#(http(s)??\:\/\/)?(www\.)?(youtube\.com\/embed\/)(.+)#', $this->faker->youtubeEmbedUri()); } + public function testYoutubeChannelUri() + { + $this->assertRegExp('#(http(s)??\:\/\/)?(www\.)?(youtube\.com\/channel\/)([a-zA-Z0-9\-]{1,})#', $this->faker->youtubeChannelUri()); + } + public function testYoutubeEmbedCode() { $this->assertRegExp('#