本文整理汇总了PHP中Config::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::shouldReceive方法的具体用法?PHP Config::shouldReceive怎么用?PHP Config::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::shouldReceive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
\Config::shouldReceive('get')->with('index.es_product_index_price_range_interval')->andReturn(1000);
$this->low_buckets = [['key' => 5000, 'doc_count' => 1], ['key' => 10000, 'doc_count' => 10], ['key' => 11000, 'doc_count' => 40], ['key' => 12000, 'doc_count' => 30], ['key' => 13000, 'doc_count' => 2], ['key' => 50000, 'doc_count' => 1]];
$this->bucket_label_mock = Mockery::mock('Ryanrobertsname\\LaravelElasticsearchRepository\\FacetsGenerator\\SmartRange\\Service\\BucketLabel\\BucketLabelerInterface');
}
示例2: setUp
public function setUp()
{
parent::setUp();
\Config::shouldReceive('get')->with('index.es_product_index_range_interval')->andReturn(1000);
$this->high_buckets = [['key' => 5000, 'doc_count' => 1], ['key' => 10000, 'doc_count' => 10], ['key' => 11000, 'doc_count' => 40], ['key' => 12000, 'doc_count' => 30], ['key' => 13000, 'doc_count' => 2], ['key' => 50000, 'doc_count' => 1]];
$this->bucket_label_mock = Mockery::mock('Giftertipster\\Service\\ESIndex\\FacetsGenerator\\SmartRange\\Service\\BucketLabel\\BucketLabelerInterface');
}
示例3: testMakeParamsThrowsInvalidArgExceptionWhenParentIdIsEmptyAndParentIdIsRequired
/**
* @expectedException InvalidArgumentException
*/
public function testMakeParamsThrowsInvalidArgExceptionWhenParentIdIsEmptyAndParentIdIsRequired()
{
$this->config['setup']['mapping']['parent'] = 'product';
\Config::shouldReceive('has')->with('index.index_products_type_add')->once()->andReturn(true);
\Config::shouldReceive('get')->with('index.index_products_type_add')->once()->andReturn($this->config);
$this->generator->makeParams('products', 'add', $this->items_stub);
}
示例4: testMakeParamsThrowsInvalidArgExceptionWhenParentIdIsEmptyAndParentIdIsRequired
/**
* @expectedException InvalidArgumentException
*/
public function testMakeParamsThrowsInvalidArgExceptionWhenParentIdIsEmptyAndParentIdIsRequired()
{
$this->config['setup']['mapping']['parent'] = 'product';
\Config::shouldReceive('has')->with('laravel-elasticsearch-repository::index.index_models.product_add')->once()->andReturn(true);
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add')->once()->andReturn($this->config);
$this->generator->makeParams('product_add', $this->items_stub);
}
开发者ID:ryanrobertsname,项目名称:laravel-elasticsearch-repository,代码行数:10,代码来源:ESBulkIndexParamsGeneratorTest.php
示例5: testComposeSetsDayList
public function testComposeSetsDayList()
{
Config::shouldReceive('get')->andReturn(array(array(1, 'Test', 'test')));
$test = new HomeComposer();
$view = Mockery::mock('day006_view');
$view->shouldReceive('with')->with('days', Mockery::any())->once();
$r = $test->compose($view);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->expected_query = ['has_child' => ['type' => 'add', 'score_type' => 'sum', 'query' => ['match_all' => []]]];
$this->search_type_config = ['query' => ['type' => 'ChildrenCount', 'params' => ['has_child_index_model' => 'product_add', 'has_child_score_type' => 'sum']], 'aggs' => ['price' => ['agg' => 'NumberRangeAgg', 'params' => ['field' => 'min_price', 'interval' => 1000, 'max_aggs' => 6]]], 'filters' => []];
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add.setup.type')->andReturn('add');
$this->gen = $this->app->make('Ryanrobertsname\\LaravelElasticsearchRepository\\ParamsGenerator\\Search\\QueryGenerator\\ChildrenCountQueryGenerator');
}
开发者ID:ryanrobertsname,项目名称:laravel-elasticsearch-repository,代码行数:8,代码来源:ChildrenCountQueryGeneratorTest.php
示例7: setUp
public function setUp()
{
parent::setUp();
$this->expected_query = ['has_child' => ['type' => 'add', 'score_type' => 'none', 'query' => ['bool' => ['must' => [['bool' => ['should' => [['term' => ['add_type_id' => ['value' => 1]]], ['term' => ['add_type_id' => ['value' => 2]]]]]], ['term' => ['occasion_ids' => ['value' => 1]]]], 'must_not' => [['term' => ['gender_ids' => ['value' => 1]]]]]]]];
$this->query_params = ['must' => ['add_type_id' => ['should' => [1, 2]], 'occasion_ids' => 1], 'must_not' => ['gender_ids' => 1]];
$this->search_type_config = ['query' => ['type' => 'FilterByChildren', 'params' => ['has_child_index_model' => 'product_add', 'fields' => ['occasion_ids' => null, 'relation_ids' => null, 'gender_ids' => null, 'interest_ids' => null, 'sub_interest_ids' => null, 'age_ids' => null, 'add_type_id' => null]]], 'aggs' => ['NumberRangeAgg' => ['field' => 'min_price']], 'filters' => []];
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add.setup.type')->andReturn('add');
$this->gen = $this->app->make('Ryanrobertsname\\LaravelElasticsearchRepository\\ParamsGenerator\\Search\\QueryGenerator\\FilterByChildrenQueryGenerator');
}
开发者ID:ryanrobertsname,项目名称:laravel-elasticsearch-repository,代码行数:9,代码来源:FilterByChildrenQueryGeneratorTest.php
示例8: setUp
public function setUp()
{
parent::setUp();
$this->client = m::mock('\\Gitter\\Client');
\Config::shouldReceive('get')->once()->with('git-pretty-stats.emailAliases')->andReturn(array('author_1_another@email.com' => 'author_1@email.com'));
$commits = array();
foreach ($this->commits as $commit) {
$commits[] = $this->createCommit($commit[0], $commit[1], $commit[2]);
}
$this->commits = $commits;
}
示例9: testParseWithNoOverridesProvidedAndNullReplacementValueInConfig
/**
* @expectedException InvalidArgumentException
*/
public function testParseWithNoOverridesProvidedAndNullReplacementValueInConfig()
{
//stubs
$string_to_parse = 'testin f saijpiojfwe fwh<!-- product link -->jkfjdf';
$parse_type = 'foobar parse type';
$parser_config = ['product_link' => ['stub' => '<!-- product link -->', 'replacement' => null]];
//mocks
Config::shouldReceive('get')->with('parser.' . $parse_type)->once()->andReturn($parser_config);
//action
$this->service()->parse($string_to_parse, $parse_type);
}
示例10: testAuthControllerRequestsDataFromGoogle
public function testAuthControllerRequestsDataFromGoogle()
{
Input::replace(array('code' => 'foo'));
Config::shouldReceive('get')->atLeast()->once()->andReturn('google');
$mock = Mockery::mock('day005_google')->shouldReceive('requestAccessToken')->once()->shouldReceive('request')->once()->andReturn('{"Foo":"Bar"}')->getMock();
OAuth::shouldReceive('consumer')->once()->andReturn($mock);
$response = $this->test->postLogin();
$this->assertPropertyExists($this->layout, 'content');
$this->assertIsView($this->layout->content);
// TODO: Figure out why this is no longer working
// $result = $this->layout->render();
// $this->assertContains('Bar', $result);
}
示例11: setUp
public function setUp()
{
parent::setUp();
$this->expected_query = ['has_child' => ['type' => 'add', 'score_type' => 'sum', 'query' => ['function_score' => ['functions' => [['filter' => ['term' => ['add_type' => 'detail_view']], 'boost_factor' => 1.2]], 'query' => ['bool' => ['should' => [['term' => ['interests' => ['value' => 'home', 'boost' => 2]]], ['term' => ['interests' => ['value' => 'cars', 'boost' => 2]]], ['term' => ['gender' => ['value' => 'male', 'boost' => 1]]]]]]]]]];
$this->query_params = ['interests' => ['home', 'cars'], 'gender' => 'male'];
/**
* Note that this config is not identical to actual production config, text values where used
* instead of value ids for readability
*/
$this->search_type_config = ['query' => ['type' => 'poll', 'params' => ['has_child_index_model' => 'product_add', 'has_child_score_type' => 'sum', 'poll_type_boosts' => ['add_type' => ['detail_view' => 1.2]], 'field_value_boosts' => ['occasion' => ['anniversary' => 1.5, 'birthday' => 2]], 'field_simularity_matches' => ['relation' => ['parent' => ['grandparent' => 0.5]], 'occasion' => ['birthday' => ['anniversary' => 0.5]]], 'fields' => ['occasion' => 2, 'relation' => 2, 'gender' => 1, 'interests' => 2, 'sub_interests' => 4, 'location' => 1, 'age' => 1]]], 'aggs' => ['NumberRangeAgg' => ['field' => 'min_price']], 'filters' => []];
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add.setup.type')->andReturn('add');
$this->gen = $this->app->make('Ryanrobertsname\\LaravelElasticsearchRepository\\ParamsGenerator\\Search\\QueryGenerator\\PollQueryGenerator');
}
示例12: makeConfigMocks
protected function makeConfigMocks(array $overrides = [])
{
$stubs = ['laravel-elasticsearch-repository::index.index_models.product' => ['setup' => ['index' => 'products', 'type' => 'product', 'mapping' => ['properties' => ['soft_delete_status' => 'integer', 'datetime' => ['type' => 'date', 'format' => 'YYYY-MM-dd HH:mm:s', 'index' => 'not_analyzed'], 'user_id' => 'integer', 'title' => 'string', 'descriptions' => 'string', 'features' => 'string', 'binding' => 'string', 'brand' => 'string', 'manufacturer' => 'string', 'model' => 'string', 'group' => ['type' => 'string', 'index' => 'not_analyzed'], 'size' => 'string', 'clothing_size' => 'string', 'min_price' => 'integer', 'max_price' => 'integer', 'keyword_profile' => 'string', 'category_keywords' => 'string'], 'parent' => null]], 'search' => ['product_search' => ['query' => ['type' => 'String', 'params' => ['append' => '~1', 'fields' => ['title' => '^5', 'descriptions' => '^3', 'features' => '^3', 'binding' => '^1', 'brand' => '^2', 'manufacturer' => '^2', 'model' => '^2', 'group' => '^1', 'size' => '^1', 'clothing_size' => '^1', 'keyword_profile' => '^2', 'category_keywords' => '^1']]], 'aggs' => ['price' => ['agg' => 'NumberRangeAgg', 'params' => ['field' => 'min_price', 'interval' => 1000, 'max_aggs' => 4]], 'group' => ['agg' => 'TermAgg', 'params' => ['field' => 'group']]], 'filters' => [['filter' => 'TermFilter', 'params' => ['field' => 'soft_delete_status', 'value' => 0], 'combine_with_like_instances' => false]]], 'filter_products' => ['query' => ['type' => null, 'params' => []], 'aggs' => [], 'filters' => []], 'add_poll' => ['query' => ['type' => 'Poll', 'params' => ['has_child_index_model' => 'product_add', 'has_child_score_type' => 'sum', 'field_simularity_matches' => ['relation_id' => [2 => [3 => 0.5]]], 'field_value_boosts' => ['relation_id' => [4 => 2]], 'poll_type_boosts' => ['add_type_id' => [2 => 500, 1 => 800]], 'fields' => ['occasion_ids' => 1, 'relation_ids' => 1, 'gender_ids' => 1, 'interest_ids' => 2, 'sub_interest_ids' => 4, 'location_ids' => 1, 'age_ids' => 1]]], 'aggs' => ['price' => ['agg' => 'NumberRangeAgg', 'params' => ['field' => 'min_price', 'interval' => 1000, 'max_aggs' => 4]], 'group' => ['agg' => 'TermAgg', 'params' => ['field' => 'group']]], 'filters' => [['filter' => 'TermFilter', 'params' => ['field' => 'soft_delete_status', 'value' => 0], 'combine_with_like_instances' => false]]], 'add_count' => ['query' => ['type' => 'ChildrenCount', 'params' => ['has_child_index_model' => 'product_add', 'has_child_score_type' => 'sum']], 'aggs' => ['price' => ['agg' => 'NumberRangeAgg', 'params' => ['field' => 'min_price', 'interval' => 1000, 'max_aggs' => 6]], 'group' => ['agg' => 'TermAgg', 'params' => ['field' => 'group']]], 'filters' => [['filter' => 'TermFilter', 'params' => ['field' => 'soft_delete_status', 'value' => 0], 'combine_with_like_instances' => false]]], 'mlt_search' => ['query' => ['type' => 'Mlt', 'params' => ['min_term_freq' => 1, 'min_doc_freq' => 1]], 'aggs' => [], 'filters' => [['filter' => 'TermFilter', 'params' => ['field' => 'soft_delete_status', 'value' => 0], 'combine_with_like_instances' => false]]], 'add_hits' => ['query' => ['type' => 'FilterByChildren', 'params' => ['has_child_index_model' => 'product_add', 'fields' => ['occasion_ids' => null, 'relation_ids' => null, 'gender_ids' => null, 'interest_ids' => null, 'sub_interest_ids' => null, 'location_ids' => null, 'age_ids' => null, 'add_type_id' => null, 'user_id' => null]]], 'aggs' => [], 'filters' => [['filter' => 'TermFilter', 'params' => ['field' => 'soft_delete_status', 'value' => 0], 'combine_with_like_instances' => false]]]]], 'laravel-elasticsearch-repository::index.index_models.product_add' => ['setup' => ['index' => 'products', 'type' => 'add', 'mapping' => ['properties' => ['occasion_ids' => 'integer', 'relation_ids' => 'integer', 'gender_ids' => 'integer', 'interest_ids' => 'integer', 'sub_interest_ids' => 'integer', 'age_ids' => 'integer', 'datetime' => ['type' => 'date', 'format' => 'YYYY-MM-dd HH:mm:s', 'index' => 'not_analyzed'], 'add_type_id' => 'integer'], 'parent' => 'product']]]];
//apply overrides
if (isset($overrides['laravel-elasticsearch-repository::index.index_models.product'])) {
$stubs['laravel-elasticsearch-repository::index.index_models.product'] = $overrides['laravel-elasticsearch-repository::index.index_models.product'];
}
if (isset($overrides['laravel-elasticsearch-repository::index.index_models.product_add'])) {
$stubs['laravel-elasticsearch-repository::index.index_models.product_add'] = $overrides['laravel-elasticsearch-repository::index.index_models.product_add'];
}
//mock config for "product" index model
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product')->andReturn($stubs['laravel-elasticsearch-repository::index.index_models.product']);
//mock config for "product_add" index model
\Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add')->andReturn($stubs['laravel-elasticsearch-repository::index.index_models.product_add']);
}
开发者ID:ryanrobertsname,项目名称:laravel-elasticsearch-repository,代码行数:15,代码来源:IndexRepositoryUnitTest.php
示例13: testGetPathsWithConfigArray
public function testGetPathsWithConfigArray()
{
$firstRepositoryPath = '/path/to/first-repo';
$secondRepositoryPath = '/path/to/second-repo';
$thirdRepositoryPath = 'relative/path';
\Config::shouldReceive('get')->once()->with('git-pretty-stats.repositoriesPath')->andReturn(array($firstRepositoryPath, $secondRepositoryPath, $thirdRepositoryPath));
$firstRepository = m::mock('stdClass');
$firstRepository->shouldReceive('getRealPath')->once()->andReturn($firstRepositoryPath);
$secondRepository = m::mock('stdClass');
$secondRepository->shouldReceive('getRealPath')->once()->andReturn($secondRepositoryPath);
$thirdRepository = m::mock('stdClass');
$thirdRepository->shouldReceive('getRealPath')->once()->andReturn($thirdRepositoryPath);
$this->finder->shouldReceive('depth->directories->append')->once()->andReturn(array($firstRepository, $secondRepository, $thirdRepository));
$factory = new RepositoryFactory($this->finder, '/var/www/git-pretty-stats');
$this->assertEquals(array($firstRepositoryPath, $secondRepositoryPath, $thirdRepositoryPath), $factory->getPaths(), 'Did not load repositories paths correctly with repository array set in config');
}
示例14: testGetRunCommandExecutable
public function testGetRunCommandExecutable()
{
$executablePath = '/path/to/executable';
Config::shouldReceive('get')->with('dispatcher::executable')->andReturn($executablePath);
$this->app->instance('Indatus\\Dispatcher\\Platform', m::mock('Indatus\\Dispatcher\\Platform', function ($m) {
$m->shouldReceive('isUnix')->andReturn(true);
$m->shouldReceive('isWindows')->andReturn(false);
}));
$commandName = 'test:command';
$scheduledCommand = $this->mockCommand();
$scheduledCommand->shouldReceive('getName')->andReturn($commandName);
$scheduledCommand->shouldReceive('user')->andReturn(false);
$this->assertEquals($this->commandService->getRunCommand($scheduledCommand), implode(' ', array($executablePath, base_path() . '/artisan', $commandName, '> /dev/null', '&')));
}
示例15: testCommand
public function testCommand()
{
\Config::shouldReceive('get')->once()->with('recipe.document_path')->andReturn(__DIR__ . "/../../docs/recipes");
$this->assertInternalType('integer', $this->command->run(new \Symfony\Component\Console\Input\ArrayInput([]), new \Symfony\Component\Console\Output\NullOutput()));
$this->assertSame('recipes to database', $this->command->getDescription());
}