Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding some extra test cases for components.

  • Loading branch information...
commit 6abf4dd2b585071edff392b27b61d032b218a25d 1 parent 4fb49a1
@zyxist zyxist authored
View
2  tests/Package/Instruction/ComponentTest.php
@@ -51,6 +51,8 @@ public static function dataProvider()
array('Component/component_inject_procedure.txt'),
array('Component/component_inject_snippet.txt'),
array('Component/component_nesting.txt'),
+ array('Component/component_template.txt'),
+ array('Component/component_template_missing.txt'),
);
} // end dataProvider();
View
29 tests/Package/Instruction/Tests/Component/component_template.txt
@@ -0,0 +1,29 @@
+This test checks, how components work with snippets.
+
+>>>>templates/test.tpl
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<opt:root xmlns:opt="http://xml.invenzzia.org/opt">
+
+<opt:snippet name="foo">
+{$system.component.foo}
+</opt:snippet>
+
+<opt:component from="$component" template="foo">
+<opt:set name="foo" value="str:bar" />
+Joe
+</opt:component>
+
+</opt:root>
+
+>>>>data.php
+
+$view->component = new Extra_Mock_Component;
+
+>>>>expected.txt
+OUTPUT
+
+>>>>result.txt
+VIEW PASSED
+PARAM foo PASSED
+PARAM foo RETURNED
+bar
View
25 tests/Package/Instruction/Tests/Component/component_template_missing.txt
@@ -0,0 +1,25 @@
+This test checks, how components work with snippets. The missing snippet should
+be ignored.
+
+>>>>templates/test.tpl
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<opt:root xmlns:opt="http://xml.invenzzia.org/opt">
+
+<opt:component from="$component" template="foo">
+<opt:set name="foo" value="str:bar" />
+Joe
+</opt:component>
+
+</opt:root>
+
+>>>>data.php
+
+$view->component = new Extra_Mock_Component;
+
+>>>>expected.txt
+OUTPUT
+
+>>>>result.txt
+VIEW PASSED
+PARAM foo PASSED
+Joe
Please sign in to comment.
Something went wrong with that request. Please try again.