当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::setExpectedException方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::setExpectedException方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::setExpectedException方法的具体用法?PHP PHPUnit_Framework_TestCase::setExpectedException怎么用?PHP PHPUnit_Framework_TestCase::setExpectedException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


在下文中一共展示了PHPUnit_Framework_TestCase::setExpectedException方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: notContainsValue

 /**
  * @test
  */
 public function notContainsValue()
 {
     $collection = $this->getCollectionInstance(['fuu', 'bar']);
     parent::assertFalse($collection->contains('baz'));
     parent::setExpectedException(KeyIsNotDefinedException::class);
     $collection->get('baz');
 }
开发者ID:oqq,项目名称:minc-common,代码行数:10,代码来源:AbstractCollectionTestCase.php

示例2: testUserCreateCommand_userCannotBeCreatedByLoggedInUser

 public function testUserCreateCommand_userCannotBeCreatedByLoggedInUser()
 {
     $adapter = app('App\\Adapters\\MockAdapter');
     $adapter->setAuthState(1, 1, false);
     \PHPUnit_Framework_TestCase::setExpectedException('App\\Exceptions\\AuthorisationException');
     $command = new UserCreateCommand('slice-beans', 'asdasd@asdas.com', 'password');
     $adapter->dispatchCommand($command);
 }
开发者ID:slice-beans,项目名称:cqs-framework,代码行数:8,代码来源:UserCreateCommandTest.php

示例3: testInstanceLimit

 public function testInstanceLimit()
 {
     $object = Stub::construct('\\WPDemo\\Generator', array(), array('getConfig' => function () {
         $config = new \WPDemo\Config();
         $config->limit = 0;
         return $config;
     }));
     \PHPUnit_Framework_TestCase::setExpectedException('\\Exception');
     $object->instantiateSession();
 }
开发者ID:sbacic,项目名称:wpdemo,代码行数:10,代码来源:GeneratorTest.php

示例4: testWebsiteScraper_aPageWithNoProductInfoThrowsAnException

 public function testWebsiteScraper_aPageWithNoProductInfoThrowsAnException()
 {
     $mockDownloader = \Mockery::mock(WebsiteDownloader::class);
     $mockDownloader->shouldReceive('download')->once()->andReturn(file_get_contents(codecept_data_dir() . 'emptyPage.html'));
     $sampleProduct = new Product("Title", "Description", "0.01", "Big");
     $mockPDPParser = \Mockery::mock(PDPParser::class);
     $mockPDPParser->shouldReceive('parseUrl')->times(0);
     \PHPUnit_Framework_TestCase::setExpectedException('Slice\\CliApp\\ScrapeException');
     $pdpParser = new WebsiteScraper($mockPDPParser, $mockDownloader);
     $productResults = $pdpParser->getProductsForUrl('http://fakeUrl.com');
 }
开发者ID:slice-beans,项目名称:cli-app,代码行数:11,代码来源:AllTest.php

示例5: testUserDetailsQuery_exceptionThrownWhenNoInfoProvided

 public function testUserDetailsQuery_exceptionThrownWhenNoInfoProvided()
 {
     $user = factory(App\Models\User::class, 1)->create();
     $user->password = 'password';
     $user->save();
     $adapter = app('App\\Adapters\\MockAdapter');
     $adapter->setAuthState(null, null, false);
     \PHPUnit_Framework_TestCase::setExpectedException('App\\Exceptions\\ValidationException');
     $command = new UserDetailsQuery();
     $adapter->dispatchCommand($command);
 }
开发者ID:slice-beans,项目名称:cqs-framework,代码行数:11,代码来源:UserDetailsQueryTest.php

示例6: testUserUpdateCommand_invalidEmailThrowsException

 public function testUserUpdateCommand_invalidEmailThrowsException()
 {
     $user = factory(App\Models\User::class)->create(['email' => 'temp@temp.com']);
     $adapter = app('App\\Adapters\\MockAdapter');
     $adapter->setAuthState($user->id, $user->id, false);
     \PHPUnit_Framework_TestCase::setExpectedException('App\\Exceptions\\ValidationException');
     $command = new UserUpdateCommand('asdfasdf');
     $adapter->dispatchCommand($command);
     $this->tester->seeRecord('users', ['id' => $user->id, 'email' => 'temp@temp.com']);
     $this->tester->dontSeeEventTriggered(\App\Events\UserUpdatedEvent::class);
 }
开发者ID:slice-beans,项目名称:cqs-framework,代码行数:11,代码来源:UserUpdateCommandTest.php

示例7: test_error_state_mismatch_response

 public function test_error_state_mismatch_response()
 {
     PHPUnit_Framework_TestCase::setExpectedException('\\Communique\\Interceptors\\JSON\\JSONParseException', 'Invalid or malformed JSON');
     $response = new \Communique\RESTClientResponse(200, 'this is not json');
     $this->JSON->response($response);
 }
开发者ID:robertmain,项目名称:communique-interceptor-json,代码行数:6,代码来源:JSONTest.php


注:本文中的PHPUnit_Framework_TestCase::setExpectedException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。