diff options
Diffstat (limited to 'tests/unit/includes/NetworkTest.php')
-rw-r--r-- | tests/unit/includes/NetworkTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
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 ], + ]; + } +} + |