File tree Expand file tree Collapse file tree 5 files changed +92
-0
lines changed Expand file tree Collapse file tree 5 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 2222 'twitter ' => '/(?:https?:)\/\/(?:www\.)?twitter\.com\/(#!\/)?(?<username>[a-zA-Z0-9-_@]+)+/m ' ,
2323 'weibo ' => '/(?:https?:)\/\/(?:[a-zA-Z0-9-_@]+\.)?weibo\.(com)\/[a-zA-Z0-9]+/m ' ,
2424 'youtube ' => '/(?:https?:)\/\/((?:www|m)\.)?((?:youtube\.(com?|[a-z]*)(?:\.[a-zA-z]{2})?|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w \\\\-]+)(.*)?$/m ' ,
25+ 'tiktok ' => '/(?:https?:)\/\/(?:www\.)?tiktok\.com\/(#!\/)?(?<username>@[a-zA-Z0-9_.]+)+/m ' ,
26+ 'opensea ' => '/(?:https?:)\/\/(?:www\.)?opensea\.io\/(#!\/)?(?:collection\/)?(?<username>[a-zA-Z0-9-_]+)+/m ' ,
27+ 'looksrare ' => '/(?:https?:)\/\/(?:www\.)?looksrare\.org\/(#!\/)?(?:(?:(?:collections)|(?:accounts))\/)(?<username>[a-zA-Z0-9]+)+/m ' ,
2528 ],
2629
2730 'social_media_name ' => [
Original file line number Diff line number Diff line change 7575 'website_url ' => 'The given website URL is not properly formatted. A valid URL must start with http[s]:// ' ,
7676 'weibo_url ' => 'The given URL is not a valid Weibo URL ' ,
7777 'youtube_url ' => 'The given URL is not a valid YouTube Channel URL ' ,
78+ 'looksrare_url ' => 'The given URL is not a valid LooksRare URL ' ,
79+ 'opensea_url ' => 'The given URL is not a valid OpenSea URL ' ,
80+ 'tiktok_url ' => 'The given URL is not a valid TikTok URL ' ,
7881 ],
7982];
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use ARKEcosystem \Foundation \Rules \ServiceLink ;
6+
7+ beforeEach (function (): void {
8+ $ this ->subject = new ServiceLink ('looksrare ' );
9+ });
10+
11+ it ('validates a valid url ' , function ($ url ) {
12+ $ this ->assertTrue ($ this ->subject ->passes ('looksrare_url ' , $ url ));
13+ })->with ([
14+ 'https://looksrare.org/collections/0x60E4d786628Fea6478F785A6d7e704777c86a7c6 ' ,
15+ 'https://looksrare.org/accounts/0xEAc80aD5AA9d5e4316d90B7Fe78eD9EBdcDe0852 ' ,
16+ ]);
17+
18+ it ('invalidates an invalid url ' , function ($ url ) {
19+ expect ($ this ->subject ->passes ('looksrare_url ' , $ url ))->toBeFalse ();
20+ })->with ([
21+ 'https://looksrare.org/collections/@0x60E4d786628Fea6478F785A6d7e704777c86a7c6 ' ,
22+ 'https://looksrare.org/0xEAc80aD5AA9d5e4316d90B7Fe78eD9EBdcDe0852 ' ,
23+ '0xEAc80aD5AA9d5e4316d90B7Fe78eD9EBdcDe0852 ' ,
24+ ]);
25+
26+ it ('has an error message ' , function () {
27+ expect ($ this ->subject ->message ())->toBe (trans ('ui::validation.social.looksrare_url ' ));
28+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use ARKEcosystem \Foundation \Rules \ServiceLink ;
6+
7+ beforeEach (function (): void {
8+ $ this ->subject = new ServiceLink ('opensea ' );
9+ });
10+
11+ it ('validates a valid url ' , function ($ url ) {
12+ $ this ->assertTrue ($ this ->subject ->passes ('opensea_url ' , $ url ));
13+ })->with ([
14+ 'https://opensea.io/collection/boredapeyachtclub ' ,
15+ 'https://opensea.io/AVDR3W_OTC ' ,
16+ 'https://opensea.io/0xA8fd8582A93D9Dc547E3D48a0a4C2fDd938A2316 ' ,
17+ ]);
18+
19+ it ('invalidates an invalid url ' , function ($ url ) {
20+ expect ($ this ->subject ->passes ('opensea_url ' , $ url ))->toBeFalse ();
21+ })->with ([
22+ 'https://opensea.io/@boredapeyachtclub ' ,
23+ '@boredapeyachtclub ' ,
24+ 'boredapeyachtclub ' ,
25+ ]);
26+
27+ it ('has an error message ' , function () {
28+ expect ($ this ->subject ->message ())->toBe (trans ('ui::validation.social.opensea_url ' ));
29+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use ARKEcosystem \Foundation \Rules \ServiceLink ;
6+
7+ beforeEach (function (): void {
8+ $ this ->subject = new ServiceLink ('tiktok ' );
9+ });
10+
11+ it ('validates a valid url ' , function ($ url ) {
12+ $ this ->assertTrue ($ this ->subject ->passes ('tiktok_url ' , $ url ));
13+ })->with ([
14+ 'https://www.tiktok.com/@msq ' ,
15+ 'https://tiktok.com/@msq ' ,
16+ 'https://tiktok.com/@msq?lang=en ' ,
17+ ]);
18+
19+ it ('invalidates an invalid url ' , function ($ url ) {
20+ expect ($ this ->subject ->passes ('tiktok_url ' , $ url ))->toBeFalse ();
21+ })->with ([
22+ 'https://tiktok.com/msq ' ,
23+ '@msq ' ,
24+ 'msq ' ,
25+ ]);
26+
27+ it ('has an error message ' , function () {
28+ expect ($ this ->subject ->message ())->toBe (trans ('ui::validation.social.tiktok_url ' ));
29+ });
You can’t perform that action at this time.
0 commit comments