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:
authormattab <matthieu.aubry@gmail.com>2014-06-06 09:52:33 +0400
committermattab <matthieu.aubry@gmail.com>2014-06-06 09:52:33 +0400
commit8ca416295df46e7331e6b8a5449911146ad71ea1 (patch)
treeb9deb2250bc05c975cd3474e54a0aace1bac3de0 /tests
parent2957313ea08ae18656298b243200f70aaa501805 (diff)
Fixes #5311 Ensure all directories in plugins/* are chmod 755, to serve html/scripts/images
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Core/ReleaseCheckListTest.php52
1 files changed, 46 insertions, 6 deletions
diff --git a/tests/PHPUnit/Core/ReleaseCheckListTest.php b/tests/PHPUnit/Core/ReleaseCheckListTest.php
index 4508690bea..08e78ebce6 100644
--- a/tests/PHPUnit/Core/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Core/ReleaseCheckListTest.php
@@ -17,6 +17,9 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
parent::setUp();
}
+
+
+
/**
* @group Core
*/
@@ -186,6 +189,37 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
/**
+ * @group Core
+ */
+ public function test_directoriesShouldBeWorldWritable()
+ {
+ $pluginsPath = realpath(PIWIK_INCLUDE_PATH . '/plugins/');
+
+ $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pluginsPath), RecursiveIteratorIterator::SELF_FIRST);
+ $paths = array();
+ foreach($objects as $name => $object){
+ if (is_dir($name)
+ && strpos($name, "/.") === false) {
+ $paths[] = $name;
+ }
+ }
+
+ $this->assertGreaterThan(50, count($paths), 'test at latest 50 directories, got ' . count($paths));
+
+ // to prevent errors with un-readable assets,
+ // we ensure all directories in plugins/* are added to git with CHMOD 755
+ foreach($paths as $pathToTest) {
+ $command = "find $pluginsPath -type d -exec chmod 755 {} +";
+
+ $chmod = substr(decoct(fileperms($pathToTest)), -3);
+ $valid = '755';
+ $this->assertSame($chmod, $valid,
+ "Some directories within plugins/ are not chmod 755. \n".
+ "Run this command to set all directories to 755: \n$command\n");;
+ }
+ }
+
+ /**
* Check that directories in plugins/ folder are specifically either enabled or disabled.
*
* This fails when a new folder is added to plugins/* and forgot to enable or mark as disabled in Manager.php.
@@ -204,8 +238,7 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
foreach($plugins as $pluginPath) {
$pluginName = basename($pluginPath);
- $gitOutput = shell_exec('git ls-files ' . $pluginPath . ' --error-unmatch 2>&1');
- $addedToGit = (strlen($gitOutput) > 0) && strpos($gitOutput, 'error: pathspec') === false;
+ $addedToGit = $this->isPathAddedToGit($pluginPath);
if(!$addedToGit) {
// if not added to git, then it is not part of the release checklist.
@@ -232,10 +265,6 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
*/
public function testEndOfLines()
{
- if (SettingsServer::isWindows()) {
- // SVN native does not make this work on windows
- return;
- }
foreach (Filesystem::globr(PIWIK_DOCUMENT_ROOT, '*') as $file) {
// skip files in these folders
if (strpos($file, '/.git/') !== false ||
@@ -347,5 +376,16 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
return ($isIniFile && $isIniFileInTests) || $isTestResultFile || $isLib;
}
+ /**
+ * @param $pluginPath
+ * @return bool
+ */
+ protected function isPathAddedToGit($pluginPath)
+ {
+ $gitOutput = shell_exec('git ls-files ' . $pluginPath . ' --error-unmatch 2>&1');
+ $addedToGit = (strlen($gitOutput) > 0) && strpos($gitOutput, 'error: pathspec') === false;
+ return $addedToGit;
+ }
+
}