コード例 #1
0
 public function testPrecondition_fail()
 {
     $this->setExpectedException('Wikimedia\\Assert\\PreconditionException');
     Assert::precondition(false, 'test');
 }
コード例 #2
0
ファイル: Balancer.php プロジェクト: paladox/mediawiki
 /**
  * Replace the element at position $idx in the BalanceStack with $elt.
  * @param int $idx
  * @param BalanceElement $elt
  */
 public function replaceAt($idx, BalanceElement $elt)
 {
     Assert::precondition($this->elements[$idx]->parent !== 'flat', 'Replaced element should not have already been flattened.');
     Assert::precondition($elt->parent !== 'flat', 'New element should not have already been flattened.');
     $this->elements[$idx] = $elt;
     if ($idx === count($this->elements) - 1) {
         $this->currentNode = $elt;
     }
 }