示例#1
0
 function _createNode()
 {
     $this->tag_info = new WactTagInfo('test', 'WactRuntimeComponentHTMLTagTestVersion');
     $component = new WactRuntimeComponentHTMLTagTestVersion($this->source_location, 'test', $this->tag_info);
     $component->setServerId('id001');
     $component->hasClosingTag = TRUE;
     $MockParent = new MockWactCompileTreeNode();
     $MockParent->setReturnValue('getComponentRefCode', '$root');
     $MockParent->parent = null;
     $component->parent = $MockParent;
     return $component;
 }
示例#2
0
 function testGenerateConstructor()
 {
     $this->component->runtimeIncludeFile = 'testinclude.inc.php';
     $this->component->runtimeComponentName = 'testname';
     $MockCode = new WactCodeWriterTestVersion();
     $MockCode->expectOnce('registerInclude', array('testinclude.inc.php'));
     $MockCode->setReturnValue('getTempVariable', 'AA');
     $MockParent = new MockWactCompileTreeNode();
     $MockParent->setReturnValue('getComponentRefCode', '$DataSpace');
     $this->component->parent = $MockParent;
     $this->component->generateConstructor($MockCode);
     $this->assertEqual($MockCode->renderCode(), '<?php $AA = new testname(\'id001\');' . "\n" . '$components[\'AA\'] = $AA;' . "\n" . '$DataSpace->addChild($AA);' . "\n" . ' ?>');
 }
示例#3
0
 function testGenerateExpressionWithContextModifierAndNoFieldName()
 {
     $context = new WactCompileTreeRootNode();
     $child1 = new MockWactCompileTreeNode();
     $child1->setReturnValue('isDataSource', true);
     $child1->setReturnValue('getServerId', 'child1');
     $child1->setReturnValue('getComponentRefCode', '$components["A"]');
     $context->addChild($child1);
     $DBE = new WactDataBindingExpressionNode('[child1]', $context);
     $DBE->analyzeExpression();
     $this->assertFalse($DBE->isConstant());
     $this->assertFalse($DBE->getFieldName());
     $code_writer = new WactCodeWriter();
     $DBE->generateExpression($code_writer);
     $this->assertEqual($code_writer->getCode(), '<?php $components["A"]');
 }
示例#4
0
 function testgetComponentRefCode()
 {
     $parent = new MockWactCompileTreeNode();
     $parent->setReturnValue('getComponentRefCode', 'Test');
     $this->component->parent = $parent;
     $this->assertEqual($this->component->getComponentRefCode(), 'Test');
 }