本文整理汇总了PHP中equalTo函数的典型用法代码示例。如果您正苦于以下问题:PHP equalTo函数的具体用法?PHP equalTo怎么用?PHP equalTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了equalTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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);
}
示例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)));
}
示例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>'));
}
示例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']]]])));
}
示例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")));
}
示例7: testDiffByKeyWithNonDefaultKey
public function testDiffByKeyWithNonDefaultKey()
{
$collectionStub = ModelStub::all();
$diff = $this->collection->diffByKey($collectionStub, 'name');
$diffNames = $diff->lists('name');
assertThat($diffNames, is(equalTo(['Taylor Otwell'])));
}
示例8: testRenderContentTextConvertsToUtf8
public function testRenderContentTextConvertsToUtf8()
{
$this->pagedTextResult->appendContentText("äöü");
$expected = htmlspecialchars("äöü", ENT_SUBSTITUTE, 'UTF-8');
assertThat($this->pagedTextResult->getText(), is(equalTo($expected)));
$this->addToAssertionCount(1);
}
示例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)));
}
示例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));
}
示例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');
}
示例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));
}
示例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));
}
示例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')));
}