From f92cde601696a48595c291e3d7546ca8109da83c Mon Sep 17 00:00:00 2001 From: kristuff Date: Sun, 16 Apr 2017 18:31:03 +0200 Subject: [PATCH 1/5] Fixed broken Filter::XSSFilter() unit tests --- tests/core/FilterTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/core/FilterTest.php b/tests/core/FilterTest.php index c92f88dae..2542bc6e9 100644 --- a/tests/core/FilterTest.php +++ b/tests/core/FilterTest.php @@ -18,9 +18,9 @@ public function testXSSFilterWithBadCode() */ public function testXSSFilterWithNonStringArguments() { - $this->assertEquals(123, 123); - $this->assertEquals(array(1, 2, 3), array(1, 2, 3)); - $this->assertEquals(17.001, 17.001); - $this->assertEquals(null, null); + $this->assertEquals(123, Filter::XSSFilter(123)); + $this->assertEquals(array(1, 2, 3), Filter::XSSFilter(array(1, 2, 3))); + $this->assertEquals(17.001, Filter::XSSFilter(17.001)); + $this->assertEquals(null, Filter::XSSFilter(null)); } } From 73c9262231d65e2584a7b7f56631f0fbd63a0d57 Mon Sep 17 00:00:00 2001 From: kristuff Date: Sun, 16 Apr 2017 23:35:58 +0200 Subject: [PATCH 2/5] should fix travis error --- tests/core/FilterTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/core/FilterTest.php b/tests/core/FilterTest.php index 2542bc6e9..a4d3cb2d2 100644 --- a/tests/core/FilterTest.php +++ b/tests/core/FilterTest.php @@ -18,9 +18,13 @@ public function testXSSFilterWithBadCode() */ public function testXSSFilterWithNonStringArguments() { - $this->assertEquals(123, Filter::XSSFilter(123)); - $this->assertEquals(array(1, 2, 3), Filter::XSSFilter(array(1, 2, 3))); - $this->assertEquals(17.001, Filter::XSSFilter(17.001)); - $this->assertEquals(null, Filter::XSSFilter(null)); + $integer = 123; + $array = [1,2,3]; + $float = 17.001; + + $this->assertEquals($integer, Filter::XSSFilter($integer)); + $this->assertEquals($array, Filter::XSSFilter($array)); + $this->assertEquals($float, Filter::XSSFilter($float)); + $this->assertNull(Filter::XSSFilter(null)); } } From 66128b56137625c8f9e758ea3a8347429d7d9db8 Mon Sep 17 00:00:00 2001 From: kristuff Date: Mon, 17 Apr 2017 02:58:25 +0200 Subject: [PATCH 3/5] PHPUnit version on travis --- .travis.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90a4d5bdc..648cbf653 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ before_script: - cd tests # run unit tests, create result file -script: phpunit --configuration phpunit.xml --coverage-text --coverage-clover=coverage.clover +script: ../vendor/bin/phpunit --configuration phpunit.xml --coverage-text --coverage-clover=coverage.clover # gets tools from Scrutinizer, uploads unit tests results to Scrutinizer (?) after_script: diff --git a/composer.json b/composer.json index 161e927c2..69b886108 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "php": ">=5.5.0", "phpmailer/phpmailer": "~5.2", "gregwar/captcha": "~1.1", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "4.8.*|5.7.*" }, "autoload": { "psr-4": { "": ["application/core/", "application/model/"] } From 878a2ac3942e20a384412c9157aa6664a698ead4 Mon Sep 17 00:00:00 2001 From: kristuff Date: Mon, 17 Apr 2017 03:01:45 +0200 Subject: [PATCH 4/5] try to make code analyzer happy :) --- tests/core/FilterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/FilterTest.php b/tests/core/FilterTest.php index a4d3cb2d2..3a406e4be 100644 --- a/tests/core/FilterTest.php +++ b/tests/core/FilterTest.php @@ -19,7 +19,7 @@ public function testXSSFilterWithBadCode() public function testXSSFilterWithNonStringArguments() { $integer = 123; - $array = [1,2,3]; + $array = [1, 2, 3]; $float = 17.001; $this->assertEquals($integer, Filter::XSSFilter($integer)); From 9d61065ff20ad430add3e2447d8feb49d86e7424 Mon Sep 17 00:00:00 2001 From: kristuff Date: Mon, 17 Apr 2017 03:11:34 +0200 Subject: [PATCH 5/5] retry to fix the test for null --- tests/core/FilterTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/core/FilterTest.php b/tests/core/FilterTest.php index 3a406e4be..10da9814c 100644 --- a/tests/core/FilterTest.php +++ b/tests/core/FilterTest.php @@ -21,10 +21,11 @@ public function testXSSFilterWithNonStringArguments() $integer = 123; $array = [1, 2, 3]; $float = 17.001; + $null = null; $this->assertEquals($integer, Filter::XSSFilter($integer)); $this->assertEquals($array, Filter::XSSFilter($array)); $this->assertEquals($float, Filter::XSSFilter($float)); - $this->assertNull(Filter::XSSFilter(null)); + $this->assertNull(Filter::XSSFilter($null)); } }