1
0
Fork 0
forked from mirror/pixelfed
pixelfed/tests/Unit/WebfingerTest.php

49 lines
1.3 KiB
PHP
Raw Normal View History

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