pixelfed/tests/Unit/WebfingerTest.php

49 lines
1.3 KiB
PHP
Raw Permalink Normal View History

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