diff options
author | Mario <mario@mariovavti.com> | 2022-03-23 18:38:03 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-03-23 18:38:03 +0000 |
commit | a41c7caa182117b2b7b820550cc20dff8be2c0f0 (patch) | |
tree | 19611241fd496b778c2f412ab9ebcc4fb34843bd /tests/unit/includes | |
parent | bddeab3ac11efaf786ddb2a6ce3f73d8c06790ab (diff) | |
parent | b3ca31bce7ed0dd5777458005718ba96985cbdc2 (diff) | |
download | volse-hubzilla-a41c7caa182117b2b7b820550cc20dff8be2c0f0.tar.gz volse-hubzilla-a41c7caa182117b2b7b820550cc20dff8be2c0f0.tar.bz2 volse-hubzilla-a41c7caa182117b2b7b820550cc20dff8be2c0f0.zip |
Merge branch 'security-fixes-lfi-xss-open-redirect' into 'dev'
Security fixes
See merge request hubzilla/core!2017
Diffstat (limited to 'tests/unit/includes')
-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 ], + ]; + } +} + |