public function RulesConditionalFrameworkTestCase::testBranchSibling in Conditional Rules 7
Same name and namespace in other branches
- 8 tests/rules_conditional.test \RulesConditionalFrameworkTestCase::testBranchSibling()
Tests branch sibling methods.
File
- tests/
rules_conditional.test, line 107 - SimpleTest testing suites.
Class
- RulesConditionalFrameworkTestCase
- Framework tests.
Code
public function testBranchSibling() {
// Set up stub objects.
$container = new RulesConditionalTestStubContainer();
$branch1 = new RulesConditionalTestStubElement();
$branch1
->setParent($container);
$branch2 = new RulesConditionalTestStubElement();
$branch2
->setParent($container);
$orphanBranch = new RulesConditionalTestStubElement();
// Test obtaining siblings.
$this
->assertIdentical($branch2, $branch1
->getNextSibling(), 'Next sibling branch can be obtained.');
$this
->assertIdentical($branch1, $branch2
->getPreviousSibling(), 'Previous sibling branch can be obtained.');
$this
->assertNull($branch1
->getPreviousSibling(), 'First branch has no previous sibling.');
$this
->assertNull($branch2
->getNextSibling(), 'Last branch has no next sibling.');
// Test obtaining siblings from an orphan element.
$this
->assertNull($orphanBranch
->getNextSibling(), 'Orphan branch has no next sibling.');
$this
->assertNull($orphanBranch
->getPreviousSibling(), 'Orphan branch has no previous sibling.');
}