當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UnitTester::assertExceptionThrown方法代碼示例

本文整理匯總了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;
     });
 }
開發者ID:webchemistry,項目名稱:parameters,代碼行數:7,代碼來源:ArrayAccessorTest.php

示例2: testCreateWithoutFactory

 public function testCreateWithoutFactory()
 {
     $factory = new \WebChemistry\Forms\Factory\Container();
     $this->tester->assertExceptionThrown('WebChemistry\\Forms\\FormException', function () use($factory) {
         $factory->create();
     });
 }
開發者ID:webchemistry,項目名稱:forms,代碼行數:7,代碼來源:ContainerTest.php

示例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');
     });
 }
開發者ID:webchemistry,項目名稱:forms,代碼行數:11,代碼來源:ControlTest.php

示例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());
 }
開發者ID:webchemistry,項目名稱:thepay,代碼行數:11,代碼來源:SenderTest.php

示例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();
     });
 }
開發者ID:webchemistry,項目名稱:thepay,代碼行數:8,代碼來源:ReceiverTest.php

示例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');
     });
 }
開發者ID:webchemistry,項目名稱:forms,代碼行數:21,代碼來源:FormTest.php


注:本文中的UnitTester::assertExceptionThrown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。