public function testPrecondition_fail() { $this->setExpectedException('Wikimedia\\Assert\\PreconditionException'); Assert::precondition(false, 'test'); }
/** * 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; } }