本文整理汇总了PHP中equalTo函数的典型用法代码示例。如果您正苦于以下问题:PHP equalTo函数的具体用法?PHP equalTo怎么用?PHP equalTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equalTo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testCategoriesMethodSetsConditionsWhenUsingMultipleCategories
public function testCategoriesMethodSetsConditionsWhenUsingMultipleCategories()
{
$filter = $this->app->make('Giftertipster\\Entity\\ProductSearchFilter\\CategoriesFilter');
$filter->categories(['foo', 'bar']);
$expected_conditions = [['group', '=', 'foo'], ['group', '=', 'bar']];
assertThat($filter->conditions(), equalTo($expected_conditions));
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:CategoriesFilterTest.php
示例2: it_can_retry_a_message
/**
* @test
*/
public function it_can_retry_a_message()
{
$id = 1234;
$body = 'test';
$routingKey = 'foo';
$priority = 3;
$headers = ['foo' => 'bar'];
/** @var MockInterface|EnvelopeInterface $envelope */
$envelope = Mock::mock(EnvelopeInterface::class);
$envelope->shouldReceive('getDeliveryTag')->andReturn($id);
$envelope->shouldReceive('getBody')->andReturn($body);
$envelope->shouldReceive('getRoutingKey')->andReturn($routingKey);
$envelope->shouldReceive('getPriority')->andReturn($priority);
$envelope->shouldReceive('getHeaders')->andReturn($headers);
$envelope->shouldReceive('getContentType')->andReturn(MessageProperties::CONTENT_TYPE_BASIC);
$envelope->shouldReceive('getDeliveryMode')->andReturn(MessageProperties::DELIVERY_MODE_PERSISTENT);
$attempt = 2;
$cooldownTime = 60;
$cooldownDate = \DateTime::createFromFormat('U', time() + $attempt * $cooldownTime);
$publisher = $this->createPublisherMock();
$publisher->shouldReceive('publish')->once()->with(Mock::on(function (Message $retryMessage) use($envelope, $attempt) {
$this->assertSame($envelope->getDeliveryTag(), $retryMessage->getId(), 'Delivery tag of the retry-message is not the same');
$this->assertSame($envelope->getBody(), $retryMessage->getBody(), 'Body of the retry-message is not the same');
$this->assertSame($envelope->getRoutingKey(), $retryMessage->getRoutingKey(), 'Routing key of the retry-message is not the same');
$this->assertArraySubset($envelope->getHeaders(), $retryMessage->getHeaders(), 'Headers are not properly cloned');
$this->assertSame($attempt, $retryMessage->getHeader(RetryProcessor::PROPERTY_KEY), 'There should be an "attempt" header in the retry message');
return true;
}), equalTo($cooldownDate))->andReturn(true);
$strategy = new BackoffStrategy($publisher, $cooldownTime);
$result = $strategy->retry($envelope, $attempt);
$this->assertTrue($result);
}
开发者ID:treehouselabs,项目名称:queue,代码行数:35,代码来源:BackoffStrategyTest.php
示例3: testCreateCsv
public function testCreateCsv()
{
$testDb = new TestLiteDb();
$testDb->createPlainTables(array('license_ref', 'license_map'));
$dbManager = $testDb->getDbManager();
$licenses = array();
for ($i = 1; $i < 4; $i++) {
$licenses[$i] = array('rf_pk' => $i, 'rf_shortname' => 'lic' . $i, 'rf_fullname' => 'lice' . $i, 'rf_text' => 'text' . $i, 'rf_url' => $i . $i, 'rf_notes' => 'note' . $i, 'rf_source' => 's' . $i, 'rf_detector_type' => 1, 'rf_risk' => $i - 1);
$dbManager->insertTableRow('license_ref', $licenses[$i]);
}
$dbManager->insertTableRow('license_map', array('rf_fk' => 3, 'rf_parent' => 1, 'usage' => LicenseMap::CONCLUSION));
$dbManager->insertTableRow('license_map', array('rf_fk' => 3, 'rf_parent' => 2, 'usage' => LicenseMap::REPORT));
$licenseCsvExport = new LicenseCsvExport($dbManager);
$head = array('shortname', 'fullname', 'text', 'parent_shortname', 'report_shortname', 'url', 'notes', 'source', 'risk');
$out = fopen('php://output', 'w');
$csv = $licenseCsvExport->createCsv();
ob_start();
fputcsv($out, $head);
fputcsv($out, array($licenses[1]['rf_shortname'], $licenses[1]['rf_fullname'], $licenses[1]['rf_text'], null, null, $licenses[1]['rf_url'], $licenses[1]['rf_notes'], $licenses[1]['rf_source'], $licenses[1]['rf_risk']));
fputcsv($out, array($licenses[2]['rf_shortname'], $licenses[2]['rf_fullname'], $licenses[2]['rf_text'], null, null, $licenses[2]['rf_url'], $licenses[2]['rf_notes'], $licenses[2]['rf_source'], $licenses[2]['rf_risk']));
fputcsv($out, array($licenses[3]['rf_shortname'], $licenses[3]['rf_fullname'], $licenses[3]['rf_text'], $licenses[1]['rf_shortname'], $licenses[2]['rf_shortname'], $licenses[3]['rf_url'], $licenses[3]['rf_notes'], $licenses[3]['rf_source'], $licenses[3]['rf_risk']));
$expected = ob_get_contents();
ob_end_clean();
assertThat($csv, is(equalTo($expected)));
$delimiter = '|';
$licenseCsvExport->setDelimiter($delimiter);
$csv3 = $licenseCsvExport->createCsv(3);
ob_start();
fputcsv($out, $head, $delimiter);
fputcsv($out, array($licenses[3]['rf_shortname'], $licenses[3]['rf_fullname'], $licenses[3]['rf_text'], $licenses[1]['rf_shortname'], $licenses[2]['rf_shortname'], $licenses[3]['rf_url'], $licenses[3]['rf_notes'], $licenses[3]['rf_source'], $licenses[3]['rf_risk']), $delimiter);
$expected3 = ob_get_contents();
ob_end_clean();
assertThat($csv3, is(equalTo($expected3)));
}
开发者ID:DanielDobre,项目名称:fossology,代码行数:34,代码来源:LicenseCsvExportTest.php
示例4: testShowFolderTreeWithContent
public function testShowFolderTreeWithContent()
{
$res = $this->prepareShowFolderTree($parentFolderId = 'foo');
$this->dbManager->shouldReceive('fetchArray')->with($res)->andReturn($rowTop = array('folder_pk' => 1, 'folder_name' => 'Top', 'folder_desc' => '', 'depth' => 0), $rowA = array('folder_pk' => 2, 'folder_name' => 'B', 'folder_desc' => '/A', 'depth' => 1), $rowB = array('folder_pk' => 3, 'folder_name' => 'B', 'folder_desc' => '/A/B', 'depth' => 2), $rowC = array('folder_pk' => 4, 'folder_name' => 'C', 'folder_desc' => '/C', 'depth' => 1), false);
$out = $this->folderNav->showFolderTree($parentFolderId);
assertThat(str_replace("\n", '', $out), equalTo('<ul id="tree"><li>' . $this->getFormattedItem($rowTop) . '<ul><li>' . $this->getFormattedItem($rowA) . '<ul><li>' . $this->getFormattedItem($rowB) . '</li></ul></li><li>' . $this->getFormattedItem($rowC) . '</li></ul></li></ul>'));
}
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:FolderNavTest.php
示例5: testCreateRouterFromController
public function testCreateRouterFromController()
{
$controller = new Fixtures\ProductController();
$router = $controller->getRouter();
assertThat($router->getStaticRoutes(), is(equalTo(['' => ['GET' => ['Rootr\\Fixtures\\ProductController', 'indexAction']]])));
assertThat($router->getVariableRoutes(), is(equalTo(['/(\\d+)' => ['GET' => [['Rootr\\Fixtures\\ProductController', 'showAction'], ['id']]], '/delete/([^/]+)' => ['DELETE' => [['Rootr\\Fixtures\\ProductController', 'deleteAction'], ['id']]]])));
}
开发者ID:eddmann,项目名称:rootr,代码行数:7,代码来源:ControllerTest.php
示例6: 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
示例7: testDiffByKeyWithNonDefaultKey
public function testDiffByKeyWithNonDefaultKey()
{
$collectionStub = ModelStub::all();
$diff = $this->collection->diffByKey($collectionStub, 'name');
$diffNames = $diff->lists('name');
assertThat($diffNames, is(equalTo(['Taylor Otwell'])));
}
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:7,代码来源:CollectionTest.php
示例8: 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
示例9: testExplodeAssocWithCustomGlueArgumentsReturnsCorrectArrayValue
public function testExplodeAssocWithCustomGlueArgumentsReturnsCorrectArrayValue()
{
$string = 'some_key:dummyvalue;another_key:anothervalue';
$expectedArray = ['some_key' => 'dummyvalue', 'another_key' => 'anothervalue'];
$explodedValue = explode_assoc($string, ':', ';');
assertThat($explodedValue, is(equalTo($expectedArray)));
}
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:7,代码来源:helpersTest.php
示例10: 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
示例11: testTakesMissedContextDescriptionFromGivenArray
public function testTakesMissedContextDescriptionFromGivenArray()
{
$storage = m::mock();
$storage->shouldReceive('ensurePresence')->with(equalTo(String::create('order/details:title', 'Here are the order details', 'H1 title in GUI', 'vfs://templates/order/details.html')))->once();
$storage->shouldReceive('ensurePresence');
self::crawler($storage, null, self::contextDescriptions())->collectTranslations(array(vfsStream::url('templates')), '.html');
}
开发者ID:magomogo,项目名称:translator-utils,代码行数:7,代码来源:CrawlerTest.php
示例12: testMaxPriceMethodSetsCondition
public function testMaxPriceMethodSetsCondition($value = '')
{
$filter = $this->app->make('Giftertipster\\Entity\\ProductSearchFilter\\PriceRangeFilter');
$filter->maxPrice(15);
$expected_conditions = [['min_price_amount', '>', 0], ['max_price_amount', '<', 15]];
assertThat($filter->conditions(), equalTo($expected_conditions));
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:PriceRangeFilterTest.php
示例13: testIsProductSuiteBlacklistedReturnsFalseWhenItIsNot
public function testIsProductSuiteBlacklistedReturnsFalseWhenItIsNot()
{
$create_response = $this->eloquent_bp->create(['vendor' => 'vendor.com', 'vendor_id' => 1]);
$prod_suite_stub = ['vendor' => 'vendor.com', 'vendor_id' => 2];
assertThat($create_response, equalTo(true));
assertThat($this->eloquent_bp->isProductSuiteBlacklisted($prod_suite_stub), identicalTo(false));
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:EloquentBlacklistedProductRepositoryTest.php
示例14: testGetProfileStringwhenNullIsProvided
public function testGetProfileStringwhenNullIsProvided()
{
$expected_keyword_string = '';
$service = $this->app->make('Giftertipster\\Service\\KeywordProfile\\KeywordProfileGenerator');
$result = $service->getProfileString(null);
assertThat($result, equalTo($expected_keyword_string));
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:KeywordProfileGeneratorTest.php
示例15: testIteratesOverAllStringsRegisteringThem
public function testIteratesOverAllStringsRegisteringThem()
{
$storage = m::mock();
$storage->shouldReceive('setTranslationValue')->with(equalTo(String::create('yes', 'Yes')))->once();
$storage->shouldReceive('setTranslationValue')->with(equalTo(String::create('validator:notEmpty', 'Should be not empty', 'Validation error messages')))->once();
$process = new Process($storage);
$process->run(array('yes' => array('Yes'), 'validator:notEmpty' => array('Should be not empty', 'Validation error messages')));
}
开发者ID:magomogo,项目名称:translator-utils,代码行数:8,代码来源:ProcessTest.php
示例16: testDispatchNotFoundRoute
public function testDispatchNotFoundRoute()
{
$dispatcher = new Dispatcher($this->router);
$response = $dispatcher->dispatch('GET', '/not-found');
assertThat($response, is(anInstanceOf('Rootr\\Response')));
assertThat($this->readAttribute($response, 'status'), is(equalTo(404)));
assertThat($this->readAttribute($response, 'body'), is(equalTo('Not Found')));
}
开发者ID:eddmann,项目名称:rootr,代码行数:8,代码来源:DispatcherTest.php
示例17: itCanBeSerialized
/** @test */
public function itCanBeSerialized()
{
$requests = $this->prophesize(RequestDefinitions::class);
$requests->getIterator()->willReturn(new \ArrayIterator());
$schema = new Schema($requests->reveal());
$serialized = serialize($schema);
assertThat(unserialize($serialized), equalTo($schema));
}
开发者ID:eleven-labs,项目名称:api-validator,代码行数:9,代码来源:SchemaTest.php
示例18: itShouldDecodeAJsonStringIntoAnArrayOfObject
/** @test */
public function itShouldDecodeAJsonStringIntoAnArrayOfObject()
{
$expected = [(object) ['foo' => 'foo1'], (object) ['foo' => 'foo2']];
$data = '[{"foo": "foo1"}, {"foo": "foo2"}]';
$decoder = new SymfonyDecoderAdapter(new JsonDecode(true));
$actual = $decoder->decode($data, 'json');
assertThat($actual, equalTo($expected));
}
开发者ID:eleven-labs,项目名称:api-validator,代码行数:9,代码来源:SymfonyDecoderAdapterTest.php
示例19: itCanResolveARequestParameterByName
/** @test */
public function itCanResolveARequestParameterByName()
{
$requestParameter = $this->prophesize(Parameter::class);
$requestParameter->getLocation()->willReturn('query');
$requestParameter->getName()->willReturn('foo');
$requestParameters = new Parameters([$requestParameter->reveal()]);
assertThat($requestParameters->getByName('foo'), equalTo($requestParameter->reveal()));
}
开发者ID:eleven-labs,项目名称:api-validator,代码行数:9,代码来源:RequestParametersTest.php
示例20: testCreateUserAnalytic
public function testCreateUserAnalytic()
{
Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => []]);
$response = $this->repo->createUserAnalytic(1, 10);
$saved_analytic = UserAnalytic::find(1)->toArray();
assertThat($response, equalTo(true));
assertThat($saved_analytic, hasKeyValuePair('quantity', 10));
assertThat($saved_analytic, hasKeyValuePair('user_id', 1));
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:9,代码来源:EloquentAnalyticsRepositoryTest.php
注:本文中的equalTo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论