From b4921db9d70401e7d48ac343d65ae60ee27d7e2c Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sun, 22 Mar 2009 00:43:25 +0000 Subject: [PATCH] BUGFIX: Get installer working with php_short_tags off (Merged r73481-3 from trunk) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@73484 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/install/config-form.html | 4 +-- tests/PhpSyntaxTest.php | 36 +++++++++++++++++++ .../i18nothermodule/code/i18nOtherModule.php | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tests/PhpSyntaxTest.php diff --git a/dev/install/config-form.html b/dev/install/config-form.html index 66ad124c6..925af2334 100644 --- a/dev/install/config-form.html +++ b/dev/install/config-form.html @@ -59,8 +59,8 @@ Template to install:

You can change the template or download another from the SilverStripe website after installation.

diff --git a/tests/PhpSyntaxTest.php b/tests/PhpSyntaxTest.php new file mode 100644 index 000000000..d789926b7 --- /dev/null +++ b/tests/PhpSyntaxTest.php @@ -0,0 +1,36 @@ +getAllFiles('php'); + $files[] = '../sapphire/dev/install/config-form.html'; + + foreach($files as $i => $file) { + $CLI_file = escapeshellarg($file); + foreach($settingTests as $settingTest) { + $returnCode = 0; + $output = array(); + exec("php -l -d $settingTest $CLI_file", $output, $returnCode); + $this->assertEquals(0, $returnCode, "Syntax error parsing $CLI_file with setting $settingTest:\n" . implode("\n", $output)); + } + } + } + + function getAllFiles($ext = 'php') { + // TODO: Unix only + $CLI_regexp = escapeshellarg("\.$ext\$"); + return explode("\n", trim(`find .. | grep $CLI_regexp`)); + } +} \ No newline at end of file diff --git a/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php b/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php index f521ea117..9021aee3e 100644 --- a/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php +++ b/tests/i18n/_fakewebroot/i18nothermodule/code/i18nOtherModule.php @@ -3,7 +3,7 @@ class i18nOtherModule extends Object { function mymethod() { _t( 'i18nOtherModule.ENTITY', - 'Other Module Entity', + 'Other Module Entity' ); } }