diff --git a/src/Fenom/Tag.php b/src/Fenom/Tag.php
index 070ff42..4e69c39 100644
--- a/src/Fenom/Tag.php
+++ b/src/Fenom/Tag.php
@@ -237,7 +237,7 @@ class Tag extends \ArrayObject
*/
public function cutContent()
{
- $content = substr($this->_body, $this->_offset + 1);
+ $content = substr($this->_body, $this->_offset);
$this->_body = substr($this->_body, 0, $this->_offset);
return $content;
}
diff --git a/tests/cases/Fenom/TemplateTest.php b/tests/cases/Fenom/TemplateTest.php
index a83f4b2..137d730 100644
--- a/tests/cases/Fenom/TemplateTest.php
+++ b/tests/cases/Fenom/TemplateTest.php
@@ -788,38 +788,6 @@ class TemplateTest extends TestCase
);
}
- public static function providerSwitch()
- {
- $code1 = 'Switch: {switch $a}
- {case 1, "one"} one
- {case 2, "two"} two
- {case "string", default} str
- {default} def
- {/switch} end';
-
- $code2 = 'Switch: {switch $a}
- {case 1, "one"} one
- {case 2, "two"} two
- {case "string"} str
- {/switch} end';
-
- $code3 = 'Switch: {switch $a} invalid
- {case 1, "one"} one
- {/switch} end';
-
- return array(
- array($code1, array("a" => 1), 'Switch: one end'),
- array($code1, array("a" => 'one'), 'Switch: one end'),
- array($code1, array("a" => 2), 'Switch: two end'),
- array($code1, array("a" => 'two'), 'Switch: two end'),
- array($code1, array("a" => "string"), 'Switch: str end'),
- array($code1, array("a" => "unk"), 'Switch: str def end'),
- array($code2, array("a" => "unk"), 'Switch: end'),
- array($code3, array("a" => 1), 'Switch: one end'),
- array($code3, array("a" => 'one'), 'Switch: one end'),
- );
- }
-
public static function providerSwitchInvalid()
{
return array(
@@ -1474,6 +1442,44 @@ class TemplateTest extends TestCase
$this->exec($code, $vars, $result);
}
+
+
+ public static function providerSwitch()
+ {
+ $code1 = 'Switch: {switch $a}
+ {case 1, "one"} one
+ {case 2, "two"} two
+ {case "string", default} str
+ {default} def
+ {/switch} end';
+
+ $code2 = 'Switch: {switch $a}
+ {case 1, "one"} one
+ {case 2, "two"} two
+ {case "string"} str
+ {/switch} end';
+
+ $code3 = 'Switch: {switch $a} invalid
+ {case 1, "one"} one
+ {/switch} end';
+
+ $code4 = 'Switch:{switch $a}{case 1}one{/switch}end';
+
+ return array(
+ array($code1, array("a" => 1), 'Switch: one end'),
+ array($code1, array("a" => 'one'), 'Switch: one end'),
+ array($code1, array("a" => 2), 'Switch: two end'),
+ array($code1, array("a" => 'two'), 'Switch: two end'),
+ array($code1, array("a" => "string"), 'Switch: str end'),
+ array($code1, array("a" => "unk"), 'Switch: str def end'),
+ array($code2, array("a" => "unk"), 'Switch: end'),
+ array($code3, array("a" => 1), 'Switch: one end'),
+ array($code3, array("a" => 'one'), 'Switch: one end'),
+ array($code4, array("a" => 1), 'Switch:oneend'),
+ );
+ }
+
+
/**
* @group switch
* @dataProvider providerSwitch