BUG Temp disable shortcode SPLIT behaviour due to crash (#6436)

Fixes #5987
This commit is contained in:
Damian Mooyman 2016-12-21 18:55:00 +13:00
parent c794c29ddb
commit f314b86ad8
2 changed files with 13 additions and 2 deletions

View File

@ -584,7 +584,8 @@ class ShortcodeParser extends Object {
$location = self::INLINE;
if($class == 'left' || $class == 'right') $location = self::BEFORE;
if($class == 'center' || $class == 'leftAlone') $location = self::SPLIT;
// Note: center / leftAlone should be `self::SPLIT`, but this crashes so we fall back to self::INLINE
// if($class == 'center' || $class == 'leftAlone') $location = self::SPLIT;
if(!$parent) {
if($location !== self::INLINE) {

View File

@ -185,7 +185,8 @@ class ShortcodeParserTest extends SapphireTest {
$this->assertEquals(preg_replace('/\s+/', '', $a), preg_replace('/\s+/', '', $b), $message);
}
public function testtExtract() {
public function testtExtractBefore()
{
// Left extracts to before the current block
$this->assertEqualsIgnoringWhitespace(
'Code<div>FooBar</div>',
@ -197,6 +198,13 @@ class ShortcodeParserTest extends SapphireTest {
'Code<div>Foo<b>BarBaz</b>Qux</div>',
$this->parser->parse('<div>Foo<b>Bar[test_shortcode class=left]Code[/test_shortcode]Baz</b>Qux</div>')
);
}
public function testExtractSplit()
{
$this->markTestSkipped(
'Feature disabled due to https://github.com/silverstripe/silverstripe-framework/issues/5987'
);
// Center splits the current block
$this->assertEqualsIgnoringWhitespace(
@ -209,7 +217,9 @@ class ShortcodeParserTest extends SapphireTest {
'<div>Foo<b>Bar</b></div>Code<div><b>Baz</b>Qux</div>',
$this->parser->parse('<div>Foo<b>Bar[test_shortcode class=center]Code[/test_shortcode]Baz</b>Qux</div>')
);
}
public function testExtractNone() {
// No class means don't extract
$this->assertEqualsIgnoringWhitespace(
'<div>FooCodeBar</div>',