From a46d0009ee4f9704aff520593762a6b5946891e1 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 8 Jun 2010 22:36:49 -0400 Subject: [PATCH] Added test case for deep parent/child contexts, mixed objects and arrays. --- .../GrandParentContext.php | 24 +++++++++++++++++++ .../grand_parent_context.mustache | 10 ++++++++ .../grand_parent_context.txt | 17 +++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 examples/grand_parent_context/GrandParentContext.php create mode 100644 examples/grand_parent_context/grand_parent_context.mustache create mode 100644 examples/grand_parent_context/grand_parent_context.txt diff --git a/examples/grand_parent_context/GrandParentContext.php b/examples/grand_parent_context/GrandParentContext.php new file mode 100644 index 0000000..5a59ed9 --- /dev/null +++ b/examples/grand_parent_context/GrandParentContext.php @@ -0,0 +1,24 @@ +parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array( + array('child_id' => 'parent1-child1'), + array('child_id' => 'parent1-child2') + )); + + $parent2 = new stdClass(); + $parent2->parent_id = 'parent2'; + $parent2->child_contexts = array( + array('child_id' => 'parent2-child1'), + array('child_id' => 'parent2-child2') + ); + + $this->parent_contexts[] = $parent2; + } +} \ No newline at end of file diff --git a/examples/grand_parent_context/grand_parent_context.mustache b/examples/grand_parent_context/grand_parent_context.mustache new file mode 100644 index 0000000..e6c07a2 --- /dev/null +++ b/examples/grand_parent_context/grand_parent_context.mustache @@ -0,0 +1,10 @@ +{{grand_parent_id}} +{{#parent_contexts}} +{{grand_parent_id}} +{{parent_id}} +{{#child_contexts}} +{{grand_parent_id}} +{{parent_id}} +{{child_id}} +{{/child_contexts}} +{{/parent_contexts}} diff --git a/examples/grand_parent_context/grand_parent_context.txt b/examples/grand_parent_context/grand_parent_context.txt new file mode 100644 index 0000000..64996ad --- /dev/null +++ b/examples/grand_parent_context/grand_parent_context.txt @@ -0,0 +1,17 @@ +grand_parent1 +grand_parent1 +parent1 +grand_parent1 +parent1 +parent1-child1 +grand_parent1 +parent1 +parent1-child2 +grand_parent1 +parent2 +grand_parent1 +parent2 +parent2-child1 +grand_parent1 +parent2 +parent2-child2