pixelfed/tests/Unit/WebfingerTest.php

50 wiersze
1.4 KiB
PHP

2021-02-13 05:50:46 +00:00
<?php
namespace Tests\Unit;
use App\Util\Lexer\Nickname;
use PHPUnit\Framework\Attributes\Test;
2022-12-21 21:21:07 +00:00
use Tests\TestCase;
2021-02-13 05:50:46 +00:00
class WebfingerTest extends TestCase
{
#[Test]
2022-12-21 21:21:07 +00:00
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
}