mirror of
https://github.com/friendica/friendica
synced 2024-12-22 14:00:15 +00:00
add test for Preferences class
This commit is contained in:
parent
9ae7b9cf01
commit
0bb8e3af80
1 changed files with 46 additions and 0 deletions
46
tests/src/Object/Api/Mastodon/PreferencesTest.php
Normal file
46
tests/src/Object/Api/Mastodon/PreferencesTest.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024, the Friendica project
|
||||
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
namespace Friendica\Test\src\Api\Mastodon;
|
||||
|
||||
use Friendica\Object\Api\Mastodon\Preferences;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PreferencesTest extends TestCase
|
||||
{
|
||||
public function testToArrayReturnsArray(): void
|
||||
{
|
||||
$preferences = new Preferences('visibility',true, 'language', 'media', false);
|
||||
|
||||
self::assertSame(
|
||||
[
|
||||
'posting:default:visibility' => 'visibility',
|
||||
'posting:default:sensitive' => true,
|
||||
'posting:default:language' => 'language',
|
||||
'reading:expand:media' => 'media',
|
||||
'reading:expand:spoilers' => false,
|
||||
],
|
||||
$preferences->toArray(),
|
||||
);
|
||||
}
|
||||
|
||||
public function testJsonSerializeReturnsArray(): void
|
||||
{
|
||||
$preferences = new Preferences('visibility',true, 'language', 'media', false);
|
||||
|
||||
self::assertSame(
|
||||
[
|
||||
'posting:default:visibility' => 'visibility',
|
||||
'posting:default:sensitive' => true,
|
||||
'posting:default:language' => 'language',
|
||||
'reading:expand:media' => 'media',
|
||||
'reading:expand:spoilers' => false,
|
||||
],
|
||||
$preferences->jsonSerialize(),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue