public function setUp()
 {
     parent::setUp();
     Artisan::call('migrate');
     Product::boot();
     Description::boot();
     SubProduct::boot();
     Image::boot();
     Feature::boot();
     Variation::boot();
     KeywordProfile::boot();
     Add::boot();
     //es client and index repo for testing integration with index
     $this->es_client = $this->app->make('Elasticsearch\\Client');
     $this->index_repo = $this->app->make('Giftertipster\\Repository\\ProductsIndex\\Product\\ESProductsIndexProductRepository');
     $this->config = \Config::get('index.index_products_type_product');
     $this->index = $this->config['setup']['index'];
     $this->type = $this->config['setup']['type'];
     //seed user id 1 & 2 for tests
     Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => []]);
     Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => []]);
     //seed add type id 1 for tests
     Factory::create('Giftertipster\\Entity\\Eloquent\\AddType');
     $this->createStubCategories();
     //mock prod suite validator (validates suite attributes keys)
     //may be overriden in individual tests
     $suite_validator = \Mockery::mock('Giftertipster\\Service\\Validate\\ProductSuite\\ProductSuiteValidationInterface');
     $suite_validator->shouldReceive('validateSuiteAttributesForCreate')->andReturn(true);
     $suite_validator->shouldReceive('validateSuiteAttributesForUpdate')->andReturn(true);
     $this->app->instance('Giftertipster\\Service\\Validate\\ProductSuite\\ProductSuiteValidationInterface', $suite_validator);
 }
 public function testUpdateForProduct()
 {
     $product = Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     $keyword_profile = Factory::make('Giftertipster\\Entity\\Eloquent\\KeywordProfile');
     $product->keywordProfile()->save($keyword_profile);
     $this->repo->updateForProduct(1, ['profile' => ['updated', 'profile']]);
     assertThat(KeywordProfile::find(1)->profile, identicalTo(['updated', 'profile']));
 }