friendica-github/tests/Unit/Object/Api/Mastodon/PreferencesTest.php

47 lines
1.2 KiB
PHP
Raw Normal View History

2024-11-04 12:22:26 +00:00
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2024-11-08 08:17:27 +00:00
namespace Friendica\Test\Unit\Object\Api\Mastodon;
2024-11-04 12:22:26 +00:00
use Friendica\Object\Api\Mastodon\Preferences;
use PHPUnit\Framework\TestCase;
class PreferencesTest extends TestCase
{
2024-11-09 10:08:40 +00:00
public function testToArrayReturnsArray(): void
{
$preferences = new Preferences('visibility', true, 'language', 'media', false);
2024-11-04 12:22:26 +00:00
2024-11-09 10:08:40 +00:00
self::assertSame(
[
'posting:default:visibility' => 'visibility',
2024-11-10 00:23:35 +00:00
'posting:default:sensitive' => true,
'posting:default:language' => 'language',
'reading:expand:media' => 'media',
'reading:expand:spoilers' => false,
2024-11-09 10:08:40 +00:00
],
$preferences->toArray(),
);
}
2024-11-04 12:22:26 +00:00
2024-11-09 10:08:40 +00:00
public function testJsonSerializeReturnsArray(): void
{
$preferences = new Preferences('visibility', true, 'language', 'media', false);
2024-11-04 12:22:26 +00:00
2024-11-09 10:08:40 +00:00
self::assertSame(
[
'posting:default:visibility' => 'visibility',
2024-11-10 00:23:35 +00:00
'posting:default:sensitive' => true,
'posting:default:language' => 'language',
'reading:expand:media' => 'media',
'reading:expand:spoilers' => false,
2024-11-09 10:08:40 +00:00
],
$preferences->jsonSerialize(),
);
}
2024-11-04 12:22:26 +00:00
}