1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-22 07:42:41 +00:00
pixelfed/tests/Unit/WebfingerTest.php
2022-12-21 22:21:07 +01:00

48 lines
1.3 KiB
PHP

<?php
namespace Tests\Unit;
use App\Util\Lexer\Nickname;
use Tests\TestCase;
class WebfingerTest extends TestCase
{
/** @test */
public function webfingerTest()
{
$expected = [
'domain' => 'pixelfed.org',
'username' => 'dansup',
];
$actual = Nickname::normalizeProfileUrl('acct:dansup@pixelfed.org');
$this->assertEquals($expected, $actual);
$expected = [
'domain' => 'pixelfed.org',
'username' => 'dansup_',
];
$actual = Nickname::normalizeProfileUrl('acct:dansup@pixelfed.org');
$this->assertNotEquals($expected, $actual);
$expected = [
'domain' => 'pixelfed.org',
'username' => 'dansup',
];
$actual = Nickname::normalizeProfileUrl('acct:@dansup@pixelfed.org');
$this->assertEquals($expected, $actual);
$expected = [
'domain' => 'pixelfed.org',
'username' => 'dansup',
];
$actual = Nickname::normalizeProfileUrl('dansup@pixelfed.org');
$this->assertEquals($expected, $actual);
$expected = [
'domain' => 'pixelfed.org',
'username' => 'dansup',
];
$actual = Nickname::normalizeProfileUrl('@dansup@pixelfed.org');
$this->assertEquals($expected, $actual);
}
}