本文整理汇总了PHP中UnitTester::assertExceptionThrown方法的典型用法代码示例。如果您正苦于以下问题:PHP UnitTester::assertExceptionThrown方法的具体用法?PHP UnitTester::assertExceptionThrown怎么用?PHP UnitTester::assertExceptionThrown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitTester
的用法示例。
在下文中一共展示了UnitTester::assertExceptionThrown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNotExists
public function testNotExists()
{
$arrayAccess = $this->getArrayAccessor();
$this->tester->assertExceptionThrown('WebChemistry\\Parameters\\ParameterNotExistsException', function () use($arrayAccess) {
$arrayAccess['notExists']->asd = NULL;
});
}
示例2: testCreateWithoutFactory
public function testCreateWithoutFactory()
{
$factory = new \WebChemistry\Forms\Factory\Container();
$this->tester->assertExceptionThrown('WebChemistry\\Forms\\FormException', function () use($factory) {
$factory->create();
});
}
示例3: testForm
public function testForm()
{
$ctrl = $this->ctrl;
$this->assertInstanceOf('WebChemistry\\Forms\\Form', $this->ctrl->createMyForm());
$this->tester->assertExceptionThrown('Nette\\InvalidStateException', function () use($ctrl) {
$ctrl->getPresenter();
});
$this->tester->assertExceptionThrown('Nette\\InvalidStateException', function () use($ctrl) {
$ctrl->flashMessage('flash');
});
}
示例4: testPrice
public function testPrice()
{
$this->tester->assertExceptionThrown('WebChemistry\\ThePay\\InvalidArgumentException', function () {
$this->thePay->createSender('test');
});
$this->tester->assertExceptionThrown('WebChemistry\\ThePay\\InvalidArgumentException', function () {
$this->thePay->createSender(['test']);
});
$this->assertSame(400.0, $this->thePay->createSender(400)->getValue());
$this->assertSame(400.0, $this->thePay->createSender('400')->getValue());
}
示例5: testPrice
public function testPrice()
{
$receiver = $this->getReceiver(['value' => 'string']);
$this->assertFalse($receiver->verifySignature(FALSE));
$this->tester->assertExceptionThrown(\WebChemistry\ThePay\ThePayException::class, function () use($receiver) {
$receiver->verifySignature();
});
}
示例6: testResetEventsArray
public function testResetEventsArray()
{
$form = new Form();
$form->onSuccess[] = function () {
};
$form->onSuccess[] = function () {
};
$form->onSubmit[] = function () {
};
$form->onError[] = function () {
};
$form->onError[] = function () {
};
$form->resetEvents(['onSuccess', 'onSubmit']);
$this->assertSame(array(), $form->onSuccess);
$this->assertSame(array(), $form->onSubmit);
$this->assertCount(2, $form->onError);
$this->tester->assertExceptionThrown('Nette\\InvalidArgumentException', function () use($form) {
$form->resetEvents('onNotExists');
});
}