本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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()));
}
示例6: testRenderContentTextConvertsToUtf8
public function testRenderContentTextConvertsToUtf8()
{
$this->pagedTextResult->appendContentText("äöü");
$expected = htmlspecialchars("äöü", ENT_SUBSTITUTE, 'UTF-8');
assertThat($this->pagedTextResult->getText(), is(equalTo($expected)));
$this->addToAssertionCount(1);
}
示例7: testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject
public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject()
{
$o1 = new stdClass();
$o2 = new stdClass();
assertThat($o1, identicalTo($o1));
assertThat($o2, not(identicalTo($o1)));
}
示例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();
}
示例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));
}
示例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")));
}
示例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));
}
示例12: testMatchesArrayContainingKeyWithNumberKeys
public function testMatchesArrayContainingKeyWithNumberKeys()
{
$array = array(1 => 'A', 2 => 'B');
assertThat($array, hasKey(1));
// very ugly version!
assertThat($array, IsArrayContainingKey::hasKeyInArray(2));
}
示例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'));
}
示例14: testIsHtmlAndNoWarningFound
public function testIsHtmlAndNoWarningFound()
{
assertThat($this->pageContent, startsWith('<!DOCTYPE html>'));
$this->assertCriticalStringNotfound('PHP Notice');
$this->assertCriticalStringNotfound('PHP Fatal error');
$this->assertCriticalStringNotfound('PHP Warning');
}
示例15: testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject
public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject()
{
$o1 = new \stdClass();
$o2 = new \stdClass();
assertThat($o1, sameInstance($o1));
assertThat($o2, not(sameInstance($o1)));
}