Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into deprecation_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Harvey committed Mar 9, 2012
2 parents 2644cbb + f01982a commit 53bf61c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion dev/install/install.php5
Expand Up @@ -670,7 +670,9 @@ class InstallRequirements {
}

function getTempFolder() {
if(file_exists($this->getBaseDir() . 'silverstripe-cache')) {
if (defined('TEMP_FOLDER')) {
$sysTmp = TEMP_FOLDER;
} elseif(file_exists($this->getBaseDir() . 'silverstripe-cache')) {
$sysTmp = $this->getBaseDir();
} elseif(function_exists('sys_get_temp_dir')) {
$sysTmp = sys_get_temp_dir();
Expand Down
19 changes: 12 additions & 7 deletions tests/parsers/ShortcodeParserTest.php
Expand Up @@ -20,12 +20,12 @@ public function setUp() {
public function testNotRegisteredShortcode() {
$this->assertEquals('[not_shortcode]', $this->parser->parse('[not_shortcode]'));
$this->assertEquals('[not_shortcode /]', $this->parser->parse('[not_shortcode /]'));
$this->assertEquals('[not_shortcode foo="bar"]', $this->parser->parse('[not_shortcode foo="bar"]'));
$this->assertEquals('[not_shortcode,foo="bar"]', $this->parser->parse('[not_shortcode,foo="bar"]'));
$this->assertEquals('[not_shortcode]a[/not_shortcode]', $this->parser->parse('[not_shortcode]a[/not_shortcode]'));
}

public function testSimpleTag() {
$tests = array('[test_shortcode]', '[test_shortcode ]', '[test_shortcode/]', '[test_shortcode /]');
$tests = array('[test_shortcode]', '[test_shortcode ]', '[test_shortcode,]', '[test_shortcode/]', '[test_shortcode /]');

foreach($tests as $test) {
$this->parser->parse($test);
Expand All @@ -38,9 +38,9 @@ public function testSimpleTag() {

public function testOneArgument() {
$tests = array (
'[test_shortcode foo="bar"]',
"[test_shortcode foo='bar']",
'[test_shortcode foo = "bar" /]'
'[test_shortcode,foo="bar"]',
"[test_shortcode,foo='bar']",
'[test_shortcode,foo = "bar" /]'
);

foreach($tests as $test) {
Expand All @@ -53,7 +53,7 @@ public function testOneArgument() {
}

public function testMultipleArguments() {
$this->parser->parse('[test_shortcode foo = "bar" bar=\'foo\' baz="buz"]');
$this->parser->parse('[test_shortcode,foo = "bar",bar=\'foo\',baz="buz"]');

$this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', 'baz' => 'buz'), $this->arguments);
$this->assertEquals('', $this->contents);
Expand All @@ -69,7 +69,7 @@ public function testEnclosing() {
}

public function testEnclosingWithArguments() {
$this->parser->parse('[test_shortcode foo = "bar" bar=\'foo\' baz="buz"]foo[/test_shortcode]');
$this->parser->parse('[test_shortcode,foo = "bar",bar=\'foo\',baz="buz"]foo[/test_shortcode]');

$this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', 'baz' => 'buz'), $this->arguments);
$this->assertEquals('foo', $this->contents);
Expand All @@ -86,6 +86,11 @@ public function testUnquotedArguments() {
$this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments);
}

public function testSpacesForDelimiter() {
$this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar baz = buz]'));
$this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments);
}

public function testSelfClosingTag() {
$this->assertEquals (
'morecontent',
Expand Down

0 comments on commit 53bf61c

Please sign in to comment.