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
This commit is contained in:
Sam Minnee 2009-03-22 00:43:25 +00:00
parent 4513631a54
commit b4921db9d7
3 changed files with 39 additions and 3 deletions

View File

@ -59,8 +59,8 @@
<b>Template to install:</b>
</p>
<ul id="Themes">
<li><input type="radio" name="template" value="blackcandy" id="BlackCandy" <?php if(!isset($_POST['template']) || $_POST['template'] == 'blackcandy') {?>checked="checked"<?}?> /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li>
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial') {?>checked="checked"<?}?>/><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li>
<li><input type="radio" name="template" value="blackcandy" id="BlackCandy" <?php if(!isset($_POST['template']) || $_POST['template'] == 'blackcandy') {?>checked="checked"<?php }?> /><label for="BlackCandy">BlackCandy, default template ready to use.</label></li>
<li><input type="radio" name="template" value="tutorial" id="EmptyTemplate" <?php if(isset($_POST['template']) && $_POST['template'] == 'tutorial') {?>checked="checked"<?php }?>/><label for="EmptyTemplate">Empty template, ready to begin the tutorial.</label></li>
</ul>
<p>You can change the template or download another from the SilverStripe website after installation.</p>

36
tests/PhpSyntaxTest.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
* Test the syntax of the PHP files with various settings
*/
class PhpSyntaxTest extends SapphireTest {
function testShortTagsOffWillWork() {
// Ignore this test completely if running the test suite on windows
// TODO: Make it work on all platforms, by building an alternative to find | grep.
$returnCode = 0;
$output = array();
exec("which find && which grep && which php", $output, $returnCode);
if($returnCode != 0) return;
$settingTests = array('short_open_tag=Off','short_open_tag=On -d asp_tags=On');
$files = $this->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`));
}
}

View File

@ -3,7 +3,7 @@ class i18nOtherModule extends Object {
function mymethod() {
_t(
'i18nOtherModule.ENTITY',
'Other Module Entity',
'Other Module Entity'
);
}
}