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


PHP assertThat函数代码示例

本文整理汇总了PHP中assertThat函数的典型用法代码示例。如果您正苦于以下问题:PHP assertThat函数的具体用法?PHP assertThat怎么用?PHP assertThat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: itProvideAResponseDefinition

 /** @test */
 public function itProvideAResponseDefinition()
 {
     $responseDefinition = $this->prophesize(ResponseDefinition::class);
     $responseDefinition->getStatusCode()->willReturn(200);
     $requestDefinition = new RequestDefinition('GET', 'getFoo', '/foo/{id}', new Parameters([]), ['application/json'], [$responseDefinition->reveal()]);
     assertThat($requestDefinition->getResponseDefinition(200), self::isInstanceOf(ResponseDefinition::class));
 }
开发者ID:eleven-labs,项目名称:api-validator,代码行数:8,代码来源:RequestDefinitionTest.php

示例2: testMakeReturnsExpectedQueryWithPollTypeBoostAndFieldSimularitiesAndFieldValueBoost

 public function testMakeReturnsExpectedQueryWithPollTypeBoostAndFieldSimularitiesAndFieldValueBoost()
 {
     $this->query_params = ['gender' => 'male', 'occasion' => 'birthday'];
     $this->expected_query = ['has_child' => ['type' => 'add', 'score_type' => 'sum', 'query' => ['function_score' => ['query' => ['bool' => ['should' => [['term' => ['gender' => ['value' => 'male', 'boost' => 1]]], ['term' => ['occasion' => ['value' => 'anniversary', 'boost' => 2.0]]], ['term' => ['occasion' => ['value' => 'birthday', 'boost' => 4]]]]]], 'functions' => [['filter' => ['term' => ['add_type' => 'detail_view']], 'boost_factor' => 1.2]]]]]];
     $result = $this->gen->make($this->query_params, $this->search_type_config);
     assertThat($result, equalTo($this->expected_query));
 }
开发者ID:ryanrobertsname,项目名称:laravel-elasticsearch-repository,代码行数:7,代码来源:PollQueryGeneratorTest.php

示例3: testValidateReturnsTrueOnSuccess

 public function testValidateReturnsTrueOnSuccess()
 {
     $filter = $this->app->make('Giftertipster\\Entity\\ProductSearchFilter\\CategoriesFilter');
     $validator = $this->app->make('Giftertipster\\Service\\Validate\\ProductSearchFilter\\FilterValidatorInterface');
     $response = $validator->validate($filter);
     assertThat($response, identicalTo(true));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AcmeFilterValidatorTest.php

示例4: testClearUserAddSelftProfile

 public function testClearUserAddSelftProfile()
 {
     \Session::put('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile', 'test');
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(true));
     $this->add_profile_mgr->clearUserAddSelfProfile();
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(false));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AddProfileMgrTest.php

示例5: testEvaluatesToTrueIfArgumentIsNull

 public function testEvaluatesToTrueIfArgumentIsNull()
 {
     assertThat(null, nullValue());
     assertThat(self::ANY_NON_NULL_ARGUMENT, not(nullValue()));
     assertThat(self::ANY_NON_NULL_ARGUMENT, notNullValue());
     assertThat(null, not(notNullValue()));
 }
开发者ID:zhangjingli35,项目名称:hamcrest,代码行数:7,代码来源:IsNullTest.php

示例6: testRenderContentTextConvertsToUtf8

 public function testRenderContentTextConvertsToUtf8()
 {
     $this->pagedTextResult->appendContentText("äöü");
     $expected = htmlspecialchars("äöü", ENT_SUBSTITUTE, 'UTF-8');
     assertThat($this->pagedTextResult->getText(), is(equalTo($expected)));
     $this->addToAssertionCount(1);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:PagedTextResultTest.php

示例7: testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject

 public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject()
 {
     $o1 = new stdClass();
     $o2 = new stdClass();
     assertThat($o1, identicalTo($o1));
     assertThat($o2, not(identicalTo($o1)));
 }
开发者ID:zhangjingli35,项目名称:hamcrest,代码行数:7,代码来源:IsIdenticalTest.php

示例8: testInitializeDirsAndFiles

 public function testInitializeDirsAndFiles()
 {
     /**
      * dirs and files to create.
      */
     $dirs = [__DIR__ . '/../../../sql', __DIR__ . '/../../../.dbup/applied', __DIR__ . '/../../../.dbup'];
     $files = [__DIR__ . '/../../../sql/V1__sample_select.sql', __DIR__ . '/../../../.dbup/properties.ini'];
     /**
      * cleaner the created files and dirs.
      */
     $clean = function () use($dirs, $files) {
         foreach ($files as $file) {
             @unlink($file);
         }
         foreach ($dirs as $dir) {
             @rmdir($dir);
         }
     };
     $clean();
     $application = new Application();
     $application->add(new InitCommand());
     $command = $application->find('init');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName()]);
     foreach ($dirs as $dir) {
         assertThat(is_dir($dir), is(true));
     }
     foreach ($files as $file) {
         assertThat(file_exists($file), is(true));
     }
     $clean();
 }
开发者ID:brtriver,项目名称:dbup,代码行数:32,代码来源:InitCommandTest.php

示例9: testPrepWhenNullAddFormIsSupplied

 public function testPrepWhenNullAddFormIsSupplied()
 {
     $add_form_prepper = $this->app->make('Giftertipster\\Service\\Add\\AddFormPrepper');
     $prepped_add_form = $add_form_prepper->prep(null);
     $expected_prepped_add_form = [];
     assertThat($prepped_add_form, identicalTo($expected_prepped_add_form));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AddFormPrepperTest.php

示例10: replace_PhraseWithTwoWordsAndAllWordsExistingInDictionary_ReturnsTranslation

 /**
  * @test
  */
 public function replace_PhraseWithTwoWordsAndAllWordsExistingInDictionary_ReturnsTranslation()
 {
     $dictionary = [$word = 'snow' => 'white watering', $wordB = 'sun' => 'hot lighting'];
     $this->replacer->setDictionary($dictionary);
     $result = $this->replacer->replace("It's \${$word}\$ outside and \${$wordB}\$");
     assertThat($result, is(equalTo("It's white watering outside and hot lighting")));
 }
开发者ID:cmygeHm,项目名称:KataLessons,代码行数:10,代码来源:DictionaryReplacerTest.php

示例11: testFilterWhenThereAreDuplicatesAndNoPrimary

 public function testFilterWhenThereAreDuplicatesAndNoPrimary()
 {
     $suite_images = [['category' => 'variant', 'field1' => 'foobar', 'field2' => 'foobar'], ['category' => 'variant', 'field1' => 'foobar1', 'field2' => 'foobar2'], ['category' => 'variant', 'field1' => 'foobar', 'field2' => 'foobar']];
     $expected_filtered_images = [['category' => 'variant', 'field1' => 'foobar', 'field2' => 'foobar'], ['category' => 'variant', 'field1' => 'foobar1', 'field2' => 'foobar2']];
     $filtered_images = $this->filter_service->filter($suite_images);
     assertThat($filtered_images, identicalTo($expected_filtered_images));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:ProductSuiteImageDuplicationFilterTest.php

示例12: testMatchesArrayContainingKeyWithNumberKeys

 public function testMatchesArrayContainingKeyWithNumberKeys()
 {
     $array = array(1 => 'A', 2 => 'B');
     assertThat($array, hasKey(1));
     // very ugly version!
     assertThat($array, IsArrayContainingKey::hasKeyInArray(2));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:7,代码来源:IsArrayContainingKeyTest.php

示例13: testHasPermission

 public function testHasPermission()
 {
     $auth_helper_mock = \Mockery::mock('Jacopo\\Authentication\\Helpers\\SentryAuthenticationHelper');
     $auth_helper_mock->shouldReceive('hasPermission')->once()->with(['permissions stub'])->andReturn('foobar');
     $this->app->instance('authentication_helper', $auth_helper_mock);
     assertThat($this->authMgr()->hasPermission(['permissions stub']), identicalTo('foobar'));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AuthenticatorAuthMgrTest.php

示例14: testIsHtmlAndNoWarningFound

 public function testIsHtmlAndNoWarningFound()
 {
     assertThat($this->pageContent, startsWith('<!DOCTYPE html>'));
     $this->assertCriticalStringNotfound('PHP Notice');
     $this->assertCriticalStringNotfound('PHP Fatal error');
     $this->assertCriticalStringNotfound('PHP Warning');
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:startUpTest.php

示例15: testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject

 public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject()
 {
     $o1 = new \stdClass();
     $o2 = new \stdClass();
     assertThat($o1, sameInstance($o1));
     assertThat($o2, not(sameInstance($o1)));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:7,代码来源:IsSameTest.php


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