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');
 }
 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');
 }
 /**
  * @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);
 }
 /**
  * @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);
 }
 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);
 }
 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');
 }
 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');
 }
 public function setUp()
 {
     parent::setUp();
     $this->client = m::mock('\\Gitter\\Client');
     \Config::shouldReceive('get')->once()->with('git-pretty-stats.emailAliases')->andReturn(array('*****@*****.**' => '*****@*****.**'));
     $commits = array();
     foreach ($this->commits as $commit) {
         $commits[] = $this->createCommit($commit[0], $commit[1], $commit[2]);
     }
     $this->commits = $commits;
 }
 /**
  * @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);
 }
 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);
 }
 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');
 }
 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']);
 }
 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');
 }
 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', '&')));
 }
 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());
 }
 public function testMltSearchCallsDependenciesAndReturnsExpectedDataFormat()
 {
     //doc id for mlt method
     $id = 100;
     //mocked search params returned by es search params generator
     $expected_client_search_params = ['index' => 'products', 'type' => 'product', 'id' => $id, 'search_size' => 5, 'body' => ['_source' => false]];
     //mocked response from es client search op
     $mock_es_response = ['took' => 36, 'timed_out' => false, '_shards' => ['total' => 5, 'successful' => 5, 'failed' => 0], 'hits' => ['total' => 9, 'max_scrore' => 1, 'hits' => [['_index' => 'products', '_type' => 'product', '_id' => 6, '_score' => 0.4365], ['_index' => 'products', '_type' => 'product', '_id' => 5, '_score' => 0.3365]]]];
     //expected response from repo search method
     $expected_response = ['meta' => ['total_hits' => 9], 'results' => [['_index' => 'products', '_type' => 'product', '_id' => 6, '_score' => 0.4365], ['_index' => 'products', '_type' => 'product', '_id' => 5, '_score' => 0.3365]], 'facets' => []];
     //stub for config mock
     $config_stub = ['setup' => ['index' => 'products', 'type' => 'product'], 'search' => ['mlt_search' => ['query' => ['type' => 'Mlt'], 'fields' => [], 'aggs' => [], 'filters' => []]]];
     $config_mock = \Config::shouldReceive('get')->with('index.index_products_type_product')->andReturn($config_stub);
     $es_client_mock = Mockery::mock('Elasticsearch\\Client');
     $es_client_mock->shouldReceive('mlt')->with($expected_client_search_params)->once()->andReturn($mock_es_response);
     $this->app->instance('Elasticsearch\\Client', $es_client_mock);
     $repo = $this->getRepo();
     $response = $repo->mltSearch($id, 5);
     $errors = $repo->errors();
     assertThat($response, identicalTo($expected_response));
 }
 /**
  * @expectedException InvalidArgumentException
  */
 public function testMakeParamsThrowsInvalidArgumentExceptionIfDocIdConfigCannotBeRetrieved()
 {
     \Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product')->once()->andReturn('');
     $this->gen->makeParams('product', 1);
 }
 protected function setConfigMock()
 {
     \Config::shouldReceive('has')->with('laravel-elasticsearch-repository::index.index_models.product')->andReturn(true);
     \Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product')->andReturn($this->config);
 }
 protected function getAbstractGatewayStub()
 {
     $this->commentRepo = $this->mock('MicheleAngioni\\MessageBoard\\Repos\\CommentRepositoryInterface');
     $this->likeRepo = $this->mock('MicheleAngioni\\MessageBoard\\Repos\\LikeRepositoryInterface');
     $this->postRepo = $this->mock('MicheleAngioni\\MessageBoard\\Repos\\PostRepositoryInterface');
     $this->purifier = $this->mock('MicheleAngioni\\MessageBoard\\PurifierInterface');
     $this->presenter = $this->mock('MicheleAngioni\\Support\\Presenters\\Presenter');
     $this->viewRepo = $this->mock('MicheleAngioni\\MessageBoard\\Repos\\ViewRepositoryInterface');
     Config::shouldReceive('get')->with('ma_messageboard.message_types')->andReturn(['public_mess', 'private_mess']);
     Config::shouldReceive('get')->with('ma_messageboard.posts_per_page')->andReturn(20);
     Config::shouldReceive('get')->with('ma_messageboard.user_named_route')->andReturn('user');
     return $this->getMockForAbstractClass('MicheleAngioni\\MessageBoard\\AbstractMbGateway', [$this->commentRepo, $this->likeRepo, $this->postRepo, $this->presenter, $this->purifier, $this->viewRepo]);
 }
 /**
  * Determine if the applied stuff is a category or not
  * @return void
  */
 public function testIsNotCategory()
 {
     \Config::shouldReceive('get')->andReturn('category');
     $this->categories->shouldReceive('getByUrl', 'children', 'where', 'first')->andReturn(false);
     $this->assertFalse($this->getFinder()->isCategory(array('category', 'my-category')));
 }
 public function testLoadingSchedulerCustomDriver()
 {
     Config::shouldReceive('get')->andReturn('cron');
     $resolver = new ConfigResolver();
     $this->assertInstanceOf('Indatus\\Dispatcher\\Services\\ScheduleService', $resolver->resolveServiceClass());
 }
 protected function setConfigMock()
 {
     \Config::shouldReceive('has')->with('index.index_products_type_product')->andReturn(true);
     \Config::shouldReceive('get')->with('index.index_products_type_product')->andReturn($this->config);
 }
 protected function setupMockConfig($segment = 'day006')
 {
     Request::shouldReceive('segment')->with(1)->andReturn($segment);
     Config::shouldReceive('get')->andReturn(array(array('8', 'day008', 'Day8'), array('6', 'day006', 'Day6'), array('4', 'day004', 'Day4')));
 }
 public function test_it_fetches_the_database_credentials()
 {
     \Config::shouldReceive('get')->once()->with('database.connections.mysql');
     $this->databaseDumpCommand->getDatabaseConnection();
 }
 public function setUp()
 {
     Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(array('exactWordSearch' => false));
     $this->builder = Mockery::mock('Illuminate\\Database\\Query\\Builder');
     $this->c = new QueryEngine($this->builder);
 }
 public function testValidateCartReturnsFalseAndLogsErrorsOnFailWhenThereAreErrorsInTheResponseThatAreIgnorable()
 {
     \Config::shouldReceive('get')->with('api.amz_product_api_response_validation.ignorable_error_codes')->once()->andReturn(['ignorable test code']);
     $validator = $this->app->make('Giftertipster\\Service\\Api\\AmzProductApi\\ResponseValidation');
     $api_response_stub = new \SimpleXMLElement('<xml></xml>');
     $items = $api_response_stub->addChild('Cart');
     $items->addChild('Request')->addChild('IsValid', 'true');
     $errors = $items->Request->addChild('Errors');
     $error1 = $errors->addChild('Error');
     $error2 = $errors->addChild('Error');
     $error1->addChild('Code', 'ignorable test code');
     $error1->addChild('Message', 'message one');
     $error2->addChild('Code', 'valid code');
     $error2->addChild('Message', 'message two');
     $response = $validator->validate($api_response_stub);
     $errors = $validator->errors();
     assertThat($response, identicalTo(false));
     assertThat($errors, arrayWithSize(1));
     assertThat($errors[0], equalTo('message two'));
 }
 public function testAddPopularitySearchReturnsResultOnSuccess()
 {
     //product
     $this->es_client->index(['index' => $this->product_index, 'type' => $this->product_type, 'id' => 100, 'body' => ['title' => 'test product', 'min_price' => 20000, 'max_price' => 20000, 'datetime' => '2014-02-14 00:01:01', 'group' => 'testgroup1', 'soft_delete_status' => 0], 'refresh' => true]);
     //product
     $this->es_client->index(['index' => $this->product_index, 'type' => $this->product_type, 'id' => 200, 'body' => ['title' => 'test product2', 'min_price' => 30000, 'max_price' => 20000, 'datetime' => '2014-02-14 00:01:01', 'group' => 'testgroup2', 'soft_delete_status' => 0], 'refresh' => true]);
     //add
     $this->es_client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 1, 'parent' => 100, 'body' => ['gender_ids' => 1, 'interest_ids' => [1, 2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     //add
     $this->es_client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 2, 'parent' => 100, 'body' => ['gender_ids' => 2, 'interest_ids' => [2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     //add
     $this->es_client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 3, 'parent' => 200, 'body' => ['gender_ids' => 1, 'interests\\_ids' => [2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     \Config::shouldReceive('get')->with('laravel-elasticsearch-repository::index.index_models.product_add.setup.type')->andReturn('add');
     $result = $this->repo->model('product')->search('add_count', null, 0, 100);
     assertThat($result, hasKey('results'));
     assertThat($result['results'], not(emptyArray()));
     assertThat($result['results'][0], not(hasKey('_source')));
     assertThat($result['meta']['total_hits'], atLeast(1));
     assertThat($result, hasKey('facets'));
     assertThat($result['facets'], hasKey('price'));
     assertThat($result['facets']['price'], not(emptyArray()));
     assertThat($result['facets'], hasKey('group'));
 }
 /**
  * @expectedException InvalidArgumentException
  */
 public function testMakeParamsThrowsInvalidArgumentExceptionIfDocIdConfigCannotBeRetrieved()
 {
     \Config::shouldReceive('get')->with('index.index_products_type_product')->once()->andReturn('');
     $this->gen->makeParams('products', 'product', 1);
 }
Example #29
0
 protected function setUp()
 {
     parent::setUp();
     Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.table")->andReturn(array('class' => 'table table-bordered', 'id' => '', 'options' => array("sPaginationType" => "full_numbers", "bProcessing" => false), 'callbacks' => array(), 'noScript' => false, 'table_view' => 'datatable::template', 'script_view' => 'datatable::javascript'));
     $this->table = new Table();
 }