-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request afup#1557 from stakovicz/issue-1285-mastodon-link
afup#1285 speaker display mastodon link better username match
- Loading branch information
Showing
4 changed files
with
84 additions
and
24 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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace AppBundle\Event\Model\tests\units; | ||
|
||
use AppBundle\Event\Model\Speaker as TestedClass; | ||
|
||
class Speaker extends \atoum | ||
{ | ||
public function testMastodon() | ||
{ | ||
$data = [ | ||
['', '', ''], | ||
['https://phpc.social/@username', 'username', 'https://phpc.social/@username'], | ||
['https://mastodon.social/@username', 'username', 'https://mastodon.social/@username'], | ||
['https://@[email protected]', 'username', 'https://mastodon.social/@username'], | ||
['http://@[email protected]', 'username', 'https://mastodon.social/@username'], | ||
]; | ||
|
||
foreach($data as $expected) { | ||
$this | ||
->given($speaker = new TestedClass()) | ||
->when($speaker->setMastodon($expected[0])) | ||
->then | ||
->string($speaker->getUsernameMastodon()) | ||
->isEqualTo($expected[1]) | ||
->string($speaker->getUrlMastodon()) | ||
->isEqualTo($expected[2]); | ||
} | ||
} | ||
|
||
|
||
public function testTwitter() | ||
{ | ||
$data = [ | ||
['', '', ''], | ||
['https://twitter.com/username', 'username', 'https://x.com/username'], | ||
['https://x.com/username', 'username', 'https://x.com/username'], | ||
['http://twitter.com/username', 'username', 'https://x.com/username'], | ||
]; | ||
|
||
foreach($data as $expected) { | ||
$this | ||
->given($speaker = new TestedClass()) | ||
->when($speaker->setTwitter($expected[0])) | ||
->then | ||
->string($speaker->getUsernameTwitter()) | ||
->isEqualTo($expected[1]) | ||
->string($speaker->getUrlTwitter()) | ||
->isEqualTo($expected[2]); | ||
} | ||
} | ||
} |