コード例 #1
0
 /**
  * Base functionality tested in {@link SiteTreeTest->testAllowedChildrenValidation()}.
  */
 function testAllowedChildrenLimitedOnVirtualPages()
 {
     $classA = new SiteTreeTest_ClassA();
     $classA->write();
     $classB = new SiteTreeTest_ClassB();
     $classB->write();
     $classBVirtual = new VirtualPage();
     $classBVirtual->CopyContentFromID = $classB->ID;
     $classBVirtual->write();
     $classC = new SiteTreeTest_ClassC();
     $classC->write();
     $classCVirtual = new VirtualPage();
     $classCVirtual->CopyContentFromID = $classC->ID;
     $classCVirtual->write();
     $classBVirtual->ParentID = $classA->ID;
     $valid = $classBVirtual->validate();
     $this->assertTrue($valid->valid(), "Does allow child linked to virtual page type allowed by parent");
     $classCVirtual->ParentID = $classA->ID;
     $valid = $classCVirtual->validate();
     $this->assertFalse($valid->valid(), "Doesn't allow child linked to virtual page type disallowed by parent");
 }