-<?php\r
-/**\r
- * Created by PhpStorm.\r
- * User: benlo\r
- * Date: 25/03/19\r
- * Time: 21:36\r
- */\r
-\r
-namespace Friendica\Test\src\Content;\r
-\r
-use Friendica\Content\Smilies;\r
-use Friendica\Test\MockedTest;\r
-use Friendica\Test\Util\AppMockTrait;\r
-use Friendica\Test\Util\L10nMockTrait;\r
-use Friendica\Test\Util\VFSTrait;\r
-\r
-class SmiliesTest extends MockedTest\r
-{\r
- use VFSTrait;\r
- use AppMockTrait;\r
- use L10nMockTrait;\r
-\r
- protected function setUp()\r
- {\r
- parent::setUp();\r
- $this->setUpVfsDir();\r
- $this->mockApp($this->root);\r
- $this->app->videowidth = 425;\r
- $this->app->videoheight = 350;\r
- $this->configMock->shouldReceive('get')\r
- ->with('system', 'no_smilies')\r
- ->andReturn(false);\r
- $this->configMock->shouldReceive('get')\r
- ->with(false, 'system', 'no_smilies')\r
- ->andReturn(false);\r
- }\r
-\r
- public function dataLinks()\r
- {\r
- return [\r
- /** @see https://github.com/friendica/friendica/pull/6933 */\r
- 'bug-6933-1' => [\r
- 'data' => '<code>/</code>',\r
- 'smilies' => ['texts' => [], 'icons' => []],\r
- 'expected' => '<code>/</code>',\r
- ],\r
- 'bug-6933-2' => [\r
- 'data' => '<code>code</code>',\r
- 'smilies' => ['texts' => [], 'icons' => []],\r
- 'expected' => '<code>code</code>',\r
- ],\r
- ];\r
- }\r
-\r
- /**\r
- * Test replace smilies in different texts\r
- * @dataProvider dataLinks\r
- *\r
- * @param string $text Test string\r
- * @param array $smilies List of smilies to replace\r
- * @param string $expected Expected result\r
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException\r
- */\r
- public function testReplaceFromArray($text, $smilies, $expected)\r
- {\r
- $output = Smilies::replaceFromArray($text, $smilies);\r
- $this->assertEquals($expected, $output);\r
- }\r
-}\r
+<?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * Created by PhpStorm.
+ * User: benlo
+ * Date: 25/03/19
+ * Time: 21:36
+ */
+
+namespace Friendica\Test\src\Content;
+
+use Friendica\Content\Smilies;
+use Friendica\DI;
+use Friendica\Network\HTTPException\InternalServerErrorException;
+use Friendica\Test\FixtureTest;
+
+class SmiliesTest extends FixtureTest
+{
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ DI::config()->set('system', 'no_smilies', false);
+ }
+
+ public function dataLinks()
+ {
+ return [
+ /** @see https://github.com/friendica/friendica/pull/6933 */
+ 'bug-6933-1' => [
+ 'data' => '<code>/</code>',
+ 'smilies' => ['texts' => [], 'icons' => []],
+ 'expected' => '<code>/</code>',
+ ],
+ 'bug-6933-2' => [
+ 'data' => '<code>code</code>',
+ 'smilies' => ['texts' => [], 'icons' => []],
+ 'expected' => '<code>code</code>',
+ ],
+ ];
+ }
+
+ /**
+ * Test replace smilies in different texts
+ *
+ * @dataProvider dataLinks
+ *
+ * @param string $text Test string
+ * @param array $smilies List of smilies to replace
+ * @param string $expected Expected result
+ *
+ * @throws InternalServerErrorException
+ */
+ public function testReplaceFromArray(string $text, array $smilies, string $expected)
+ {
+ $output = Smilies::replaceFromArray($text, $smilies);
+ self::assertEquals($expected, $output);
+ }
+}