summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-07-13 10:36:55 -0700
committerBharat Mediratta <bharat@menalto.com>2009-07-13 10:36:55 -0700
commite2a9a1d28459b96e412004df4d4ec010fb9b30e2 (patch)
tree444213323fb03bcb790449a943ce95d48aab37e5 /modules/gallery
parenta944bf4259a6ff31ac647a3d8336bd5175c3640a (diff)
Add quotes around all values that contain spaces in them, and add a
test to make sure that we continue to do so. This makes sure that we don't have problems with 5.3 which treats the literal "on" as a boolean.
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/module.info4
-rw-r--r--modules/gallery/tests/File_Structure_Test.php37
2 files changed, 39 insertions, 2 deletions
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index c184aba7..64a30b1f 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
-name = Gallery 3
-description = Gallery core application
+name = "Gallery 3"
+description = "Gallery core application"
version = 6
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 06f456ff..8a97e00b 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -213,6 +213,43 @@ class File_Structure_Test extends Unit_Test_Case {
}
}
}
+
+ public function module_info_is_well_formed_test() {
+ $info_files = array_merge(
+ glob("modules/*/module.info"),
+ glob("themes/*/module.info"));
+
+ $errors = array();
+ foreach ($info_files as $file) {
+ foreach (file($file) as $line) {
+ $parts = explode("=", $line, 2);
+ $values[trim($parts[0])] = trim($parts[1]);
+ }
+
+ $module = dirname($file);
+ // Certain keys must exist
+ foreach (array("name", "description", "version") as $key) {
+ if (!array_key_exists($key, $values)) {
+ $errors[] = "$module: missing key $key";
+ }
+ }
+
+ // Any values containing spaces must be quoted
+ foreach ($values as $key => $value) {
+ if (strpos($value, " ") !== false && !preg_match('/^".*"$/', $value)) {
+ $errors[] = "$module: value for $key must be quoted";
+ }
+ }
+
+ // The file must parse
+ if (!is_array(parse_ini_file($file))) {
+ $errors[] = "$module: info file is not parseable";
+ }
+ }
+ if ($errors) {
+ $this->assert_true(false, $errors);
+ }
+ }
}
class PhpCodeFilterIterator extends FilterIterator {