/**
  * @test
  * @return void
  */
 public function testIsPassingToStorageBackend()
 {
     $enrichment = new Enrichment();
     $enrichment->setTitle('test');
     $enrichment->setId(44);
     $violationList = $this->getMock('\\Symfony\\Component\\Validator\\ConstraintViolationList', array('count'), array(), '', FALSE);
     $violationList->expects($this->once())->method('count')->will($this->returnValue(0));
     $validator = $this->getMock('\\Symfony\\Component\\Validator\\Validator', array('validate'), array(), '', FALSE);
     $validator->expects($this->once())->method('validate')->will($this->returnValue($violationList));
     $storageBackendMock = $this->getMock('\\Searchperience\\Api\\Client\\System\\Storage\\RestEnrichmentBackend', array('post'), array(), '', false);
     $this->enrichmentRepository->injectStorageBackend($storageBackendMock);
     $this->enrichmentRepository->injectValidator($validator);
     $this->enrichmentRepository->add($enrichment);
 }
 /**
  * @test
  */
 public function verifyContextsBoostingCanBeRetrievedFromEnrichment()
 {
     $contextsBoostingArrayOfObjects = $this->generateContextsBoosting('category', 'naiset_asusteet', 'is_loyalty', true, 5.0, 2);
     $this->enrichment->addContextsBoosting($contextsBoostingArrayOfObjects[0])->addContextsBoosting($contextsBoostingArrayOfObjects[1]);
     $contextsBoostingCollection = $this->enrichment->getContextsBoosting();
     /** @var ContextsBoosting $contextsBoostingFirst */
     $contextsBoostingFirst = $contextsBoostingCollection->offsetGet(1);
     $this->assertEquals("category1", $contextsBoostingFirst->getBoostFieldName());
     $this->assertEquals("naiset_asusteet1", $contextsBoostingFirst->getBoostFieldValue());
     $this->assertEquals("is_loyalty1", $contextsBoostingFirst->getBoostOptionName());
     $this->assertEquals(true, (bool) $contextsBoostingFirst->getBoostOptionValue());
     $this->assertEquals(6.0, (double) $contextsBoostingFirst->getBoostingValue());
 }