Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2021-07-16 06:02:36 +0300
committerGitHub <noreply@github.com>2021-07-16 06:02:36 +0300
commitdc29fc3e39e3696b7c3f188f23d3fe415afa42bd (patch)
treed9b565765c55dc4541cfd78d6112fc979ed042f6 /tests
parent5b9076d7535142365be6a5789a6395aa03b3bd13 (diff)
add config to read the last IP address in the list of proxies rather than the first (#17765)
* by default read the last IP address in the list of proxies rather than the first * apply review feedback * apply review feedback * update expected screenshot
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Unit/IPTest.php36
-rw-r--r--tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png4
2 files changed, 38 insertions, 2 deletions
diff --git a/tests/PHPUnit/Unit/IPTest.php b/tests/PHPUnit/Unit/IPTest.php
index 73c90af0d4..02d69288f5 100644
--- a/tests/PHPUnit/Unit/IPTest.php
+++ b/tests/PHPUnit/Unit/IPTest.php
@@ -196,4 +196,40 @@ class IPTest extends \PHPUnit\Framework\TestCase
// with excluded Ips
$this->assertEquals('', IP::getFirstIpFromList('10.10.10.10, 10.10.10.10', array('10.10.10.10')));
}
+
+ /**
+ * Dataprovider for testGetLastIpFromList
+ */
+ public function getLastIpFromListTestData()
+ {
+ return array(
+ array('', ''),
+ array('127.0.0.1', '127.0.0.1'),
+ array(' 127.0.0.1 ', '127.0.0.1'),
+ array(' 192.168.1.1, 127.0.0.1', '127.0.0.1'),
+ array('192.168.1.1 ,127.0.0.1 ', '127.0.0.1'),
+ array('2001:db8:cafe::17 , 192.168.1.1', '192.168.1.1'),
+ array('192.168.1.1 , 2001:db8:cafe::17', '2001:db8:cafe::17'),
+ array('192.168.1.1,', '192.168.1.1'),
+ array(',192.168.1.1,', '192.168.1.1'),
+ );
+ }
+
+ /**
+ * @dataProvider getLastIpFromListTestData
+ */
+ public function testGetLastIpFromList($csv, $expected)
+ {
+ // without excluded IPs
+ $this->assertEquals($expected, IP::getLastIpFromList($csv));
+
+ // with excluded Ips
+ $this->assertEquals($expected, IP::getLastIpFromList($csv . ', 10.10.10.10', array('10.10.10.10')));
+ }
+
+ public function testGetLastIpFromList_shouldReturnAnEmptyString_IfMultipleIpsAreGivenButAllAreExcluded()
+ {
+ // with excluded Ips
+ $this->assertEquals('', IP::getLastIpFromList('10.10.10.10, 10.10.10.10', array('10.10.10.10')));
+ }
}
diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
index e8abbb5121..c5f2876887 100644
--- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
+++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3a1d75f489ae0fb47ea4c3c23c1b22be612461d7f8cb606a0f6fb0e4e24e4693
-size 4993514
+oid sha256:63d1fda5a14bdde54a70758fb10213dec6d63312241445cbac0242ea4ad12ee8
+size 5019510