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
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2016-02-08 03:09:57 +0300
committermattab <matthieu.aubry@gmail.com>2016-02-08 03:09:57 +0300
commit437fd9744543b14130d58c3ea5b7b10495e8e7a7 (patch)
tree88f38e775480902aef57300f4a874c96d1f78cb0
parent35f85973d7e9c14f12145d9fcdf7b23f818aa6a3 (diff)
New release check list integration test to pro-actively detect 'abnormal whitespaces' issue
Refs #9729 #9715 #9712
-rw-r--r--libs/bower_components/angular/angular.js2
m---------plugins/CustomDimensions0
-rw-r--r--tests/PHPUnit/Integration/ReleaseCheckListTest.php65
3 files changed, 65 insertions, 2 deletions
diff --git a/libs/bower_components/angular/angular.js b/libs/bower_components/angular/angular.js
index ccf3b4bafe..a72a457951 100644
--- a/libs/bower_components/angular/angular.js
+++ b/libs/bower_components/angular/angular.js
@@ -13333,7 +13333,7 @@ function adjustMatchers(matchers) {
*
* - your app is hosted at url `http://myapp.example.com/`
* - but some of your templates are hosted on other domains you control such as
- * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc.
* - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
*
* Here is what a secure configuration for this scenario might look like:
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions
-Subproject 566313496c8338794480c85adeb4aa854d878a3
+Subproject 03eed12ec5a6acaf489f7e6ba7d71c846e74fb1
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
index 58970199f0..6d8553802a 100644
--- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
@@ -184,6 +184,30 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase
}
}
+ public function test_jsfilesDoNotContainFakeSpaces()
+ {
+ $js = Filesystem::globr(PIWIK_INCLUDE_PATH, '*.js');
+ $this->checkFilesDoNotHaveWeirdSpaces($js);
+ }
+
+ public function test_phpfilesDoNotContainFakeSpaces()
+ {
+ $js = Filesystem::globr(PIWIK_INCLUDE_PATH, '*.php');
+ $this->checkFilesDoNotHaveWeirdSpaces($js);
+ }
+
+ public function test_twigfilesDoNotContainFakeSpaces()
+ {
+ $js = Filesystem::globr(PIWIK_INCLUDE_PATH, '*.twig');
+ $this->checkFilesDoNotHaveWeirdSpaces($js);
+ }
+
+ public function test_htmlfilesDoNotContainFakeSpaces()
+ {
+ $js = Filesystem::globr(PIWIK_INCLUDE_PATH, '*.html');
+ $this->checkFilesDoNotHaveWeirdSpaces($js);
+ }
+
public function test_directoriesShouldBeChmod755()
{
$pluginsPath = realpath(PIWIK_INCLUDE_PATH . '/plugins/');
@@ -422,7 +446,7 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase
}
// in build-package.sh we have: `find ./ -iname 'tests' -type d -prune -exec rm -rf {} \;`
- if(stripos($file, "/tests/") !== false) {
+ if($this->isFileBelongToTests($file)) {
return false;
}
if(strpos($file, PIWIK_INCLUDE_PATH . "/tmp/") !== false) {
@@ -586,4 +610,43 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase
}
return $filesizes;
}
+
+ /**
+ * @param $files
+ * @throws Exception
+ */
+ protected function checkFilesDoNotHaveWeirdSpaces($files)
+ {
+ $weirdSpace = ' ';
+ $this->assertEquals('c2a0', bin2hex($weirdSpace), "Checking that this test file was not tampered with");
+ $this->assertEquals('20', bin2hex(' '), "Checking that this test file was not tampered with");
+
+ $errors = array();
+ foreach ($files as $file) {
+
+ if($this->isFileBelongToTests($file)) {
+ continue;
+ }
+
+ $content = file_get_contents($file);
+ $posWeirdSpace = strpos($content, $weirdSpace);
+ if ($posWeirdSpace !== false) {
+ $around = substr($content, $posWeirdSpace - 20, 40);
+ $around = trim($around);
+ $errors[] = "File $file contains an unusual space character, please remove it from here: ...$around...";
+ }
+ }
+ if (!empty($errors)) {
+ throw new Exception(implode(",\n\n ", $errors));
+ }
+ }
+
+ /**
+ * @param $file
+ * @return bool
+ */
+ private function isFileBelongToTests($file)
+ {
+ return stripos($file, "/tests/") !== false;
+ }
}