Skip to content

Commit

Permalink
Update Youtube Channel Faker in order to include user in the uri
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Lopez committed Oct 4, 2019
1 parent 7ae48a1 commit 7ac7b54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public function youtubeEmbedCode()

public function youtubeChannelUri()
{
return 'https://www.youtube.com/channel/' . $this->regexify(sprintf('[a-zA-Z0-9\-]{1,%s}', $this->numberBetween(1, 20)));
return sprintf('https://www.youtube.com/%s/%s',
$this->randomElement(['channel', 'user']),
$this->regexify(sprintf('[a-zA-Z0-9\-]{1,%s}', $this->numberBetween(1, 20)))
);
}

public function youtubeRandomUri()
Expand Down
2 changes: 1 addition & 1 deletion tests/Faker/YoutubeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testYoutubeEmbedUri()

public function testYoutubeChannelUri()
{
$this->assertRegExp('#(http(s)??\:\/\/)?(www\.)?(youtube\.com\/channel\/)([a-zA-Z0-9\-]{1,})#', $this->faker->youtubeChannelUri());
$this->assertRegExp('#(http(s)??\:\/\/)?(www\.)?(youtube\.com\/)(c\/|channel\/|user\/)([a-zA-Z0-9\-]{1,})#', $this->faker->youtubeChannelUri());
}

public function testYoutubeEmbedCode()
Expand Down

0 comments on commit 7ac7b54

Please sign in to comment.