This repository has been archived by the owner on May 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
117 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* The tests for opt:selector instruction. | ||
* | ||
* @author Tomasz "Zyx" Jędrzejewski | ||
* @copyright Copyright (c) 2010 Invenzzia Group | ||
* @license http://www.invenzzia.org/license/new-bsd New BSD License | ||
*/ | ||
|
||
require_once('./Extra/TestFS.php'); | ||
require_once('./Extra/TestFSBase.php'); | ||
|
||
/** | ||
* @covers Opt_Compiler_Class | ||
* @covers Opt_Compiler_Format | ||
* @covers Opt_Compiler_Processor | ||
* @covers Opt_Instruction_Section_Abstract | ||
* @covers Opt_Instruction_Selector | ||
* @runTestsInSeparateProcesses | ||
*/ | ||
class Package_Instruction_SelectorTest extends Extra_TestFSBase | ||
{ | ||
|
||
/** | ||
* Configuration method. | ||
* @param Opt_Class $tpl | ||
*/ | ||
public function configure(Opt_Class $tpl) | ||
{ | ||
$tpl->parser = 'Opt_Parser_Xml'; | ||
$tpl->register(Opt_Class::OPT_COMPONENT, 'opt:myComponent', 'Extra_Mock_Component'); | ||
$tpl->register(Opt_Class::OPT_BLOCK, 'opt:myBlock', 'Extra_Mock_Block'); | ||
} // end configure(); | ||
|
||
/** | ||
* Provides the list of test cases. | ||
* @return array | ||
*/ | ||
public static function dataProvider() | ||
{ | ||
return array(0 => | ||
array('Selector/selector_basic.txt'), | ||
array('Selector/selector_test.txt'), | ||
array('Selector/selector_show.txt'), | ||
array('Selector/selector_show_test.txt'), | ||
array('Selector/selector_else.txt'), | ||
array('Selector/selector_multiple_else.txt'), | ||
array('Selector/selector_separator.txt'), | ||
array('Selector/selector_attribute.txt'), | ||
); | ||
} // end dataProvider(); | ||
|
||
/** | ||
* @dataProvider dataProvider | ||
* @runInSeparateProcess | ||
*/ | ||
public function testInstructions($testCase) | ||
{ | ||
return $this->_checkTest(dirname(__FILE__).'/Tests/'.$testCase); | ||
} // end testInstructions(); | ||
} // end Package_Instruction_SelectorTest; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/Package/Instruction/Tests/Selector/selector_else.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
The test checks the opt:selector instruction with opt:else. | ||
|
||
>>>>templates/test.tpl | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<opt:root xmlns:opt="http://xml.invenzzia.org/opt"> | ||
<opt:selector name="sect"> | ||
<opt:equals value="foo">FOO: {$sect.val1},{$sect.val2}</opt:equals> | ||
<opt:equals value="bar">BAR: {$sect.val1},{$sect.val2}</opt:equals> | ||
<opt:else>NO DATA</opt:else> | ||
</opt:selector> | ||
</opt:root> | ||
|
||
>>>>expected.txt | ||
OUTPUT | ||
|
||
>>>>result.txt | ||
NO DATA | ||
|
||
>>>>data.php |
15 changes: 15 additions & 0 deletions
15
tests/Package/Instruction/Tests/Selector/selector_multiple_else.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Multiple opt:else should be punished. | ||
|
||
>>>>templates/test.tpl | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<opt:root xmlns:opt="http://xml.invenzzia.org/opt"> | ||
<opt:selector name="sect"> | ||
<opt:equals value="foo">FOO: {$sect.val1},{$sect.val2}</opt:equals> | ||
<opt:equals value="bar">BAR: {$sect.val1},{$sect.val2}</opt:equals> | ||
<opt:else>NO DATA</opt:else> | ||
<opt:else>NO DATA</opt:else> | ||
</opt:selector> | ||
</opt:root> | ||
|
||
>>>>expected.txt | ||
Opt_Instruction_Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...Instruction/Tests/Selector/selector_3.txt → ...truction/Tests/Selector/selector_show.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...Instruction/Tests/Selector/selector_4.txt → ...ion/Tests/Selector/selector_show_test.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters