aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/includes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/includes')
-rw-r--r--tests/unit/includes/FeedutilsTest.php2
-rw-r--r--tests/unit/includes/LanguageTest.php7
-rw-r--r--tests/unit/includes/MarkdownTest.php4
-rw-r--r--tests/unit/includes/NetworkTest.php33
4 files changed, 38 insertions, 8 deletions
diff --git a/tests/unit/includes/FeedutilsTest.php b/tests/unit/includes/FeedutilsTest.php
index e9826a73d..bda0bf425 100644
--- a/tests/unit/includes/FeedutilsTest.php
+++ b/tests/unit/includes/FeedutilsTest.php
@@ -4,6 +4,8 @@ namespace Zotlabs\Tests\Unit\includes;
use Zotlabs\Tests\Unit\UnitTestCase;
+require_once('include/feedutils.php');
+
/**
* @brief Unit Test case for include/feedutils.php file.
*/
diff --git a/tests/unit/includes/LanguageTest.php b/tests/unit/includes/LanguageTest.php
index 0ca9eacd0..9525c783d 100644
--- a/tests/unit/includes/LanguageTest.php
+++ b/tests/unit/includes/LanguageTest.php
@@ -63,11 +63,6 @@ class LanguageTest extends UnitTestCase {
public function languageExamplesProvider() {
return [
- 'empty text' => [
- '',
- '',
- null
- ],
'English' => [
'English is a West Germanic language that was first spoken in early medieval England and is now a global lingua franca.[4][5] Named after the Angles, one of the Germanic tribes that migrated to England, it ultimately derives its name from the Anglia (Angeln) peninsula in the Baltic Sea. It is closely related to the Frisian languages, but its vocabulary has been significantly influenced by other Germanic languages, particularly Norse (a North Germanic language), as well as by Latin and Romance languages, especially French.',
'en',
@@ -155,7 +150,7 @@ class LanguageTest extends UnitTestCase {
'nb',
'Norwegian Bokmål',
[
- 'de' => 'Norwegisch Bokmål',
+ 'de' => 'Norwegisch (Bokmål)',
'nb' => 'norsk bokmål'
]
]
diff --git a/tests/unit/includes/MarkdownTest.php b/tests/unit/includes/MarkdownTest.php
index 2a92a58d2..98fe40a49 100644
--- a/tests/unit/includes/MarkdownTest.php
+++ b/tests/unit/includes/MarkdownTest.php
@@ -87,8 +87,8 @@ class MarkdownTest extends UnitTestCase {
"1. Item 1\n2. Item 2\n3. Item **3**"
],
'nested lists' => [
- '<ul><li>Item 1<ol><li>Item 1a</li><li>Item <b>1b</b></ol></li><li>Item 2</li></ul>',
- "- Item 1\n 1. Item 1a\n 2. Item **1b**\n- Item 2"
+ '<ul><li>Item A</li><li>Item B<ul><li>Nested A</li><li>Nested B</li></ul></li><li>Item C</li></ul>',
+ "- Item A\n- Item B\n - Nested A\n - Nested B\n- Item C"
],
'img' => [
'<img src="/path/to/img.png" alt="alt text" title="title text">',
diff --git a/tests/unit/includes/NetworkTest.php b/tests/unit/includes/NetworkTest.php
new file mode 100644
index 000000000..0b9b42e00
--- /dev/null
+++ b/tests/unit/includes/NetworkTest.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * tests function from include/network.php
+ *
+ * @package test.util
+ */
+
+use PHPUnit\Framework\TestCase;
+
+require_once('include/network.php');
+
+class NetworkTest extends TestCase {
+
+ public function setup() : void {
+ \App::set_baseurl("https://mytest.org");
+ }
+
+ /**
+ * @dataProvider localUrlTestProvider
+ */
+ public function testIsLocalURL($url, $expected) {
+ $this->assertEquals($expected, is_local_url($url));
+ }
+
+ public function localUrlTestProvider() : array {
+ return [
+ [ '/some/path', true ],
+ [ 'https://mytest.org/some/path', true ],
+ [ 'https://other.site/some/path', false ],
+ ];
+ }
+}
+