/**
  * @test
  */
 public function canGetOneByTypeAndId()
 {
     $artifactTypeName = 'topseller';
     $artifactId = '1';
     $artifact = new GenericArtifact();
     $artifact->setId($artifactId);
     $artifact->setTypeName($artifactTypeName);
     $validator = $this->getMock('\\Symfony\\Component\\Validator\\Validator', array('validate'), array(), '', FALSE);
     $storageBackend = $this->getMock('\\Searchperience\\Api\\Client\\System\\Storage\\RestArtifactBackend', array('getOneByTypeAndId'));
     $storageBackend->expects($this->once())->method('getOneByTypeAndId')->with($artifactTypeName, $artifactId)->will($this->returnValue(new ArtifactCollection()));
     $this->repository->injectStorageBackend($storageBackend);
     $this->repository->setEntityCollectionName('\\Searchperience\\Api\\Client\\Domain\\Insight\\ArtifactCollection');
     $this->repository->injectValidator($validator);
     $this->repository->getOneByTypeAndId($artifactTypeName, $artifactId);
 }
 /**
  * @test
  */
 public function canGetOneArtifact()
 {
     $restClient = new \Guzzle\Http\Client('http://api.searchperience.me/qvc/');
     $mock = new \Guzzle\Plugin\Mock\MockPlugin();
     $mock->addResponse(new \Guzzle\Http\Message\Response(201, NULL, $this->getFixtureContent('Api/Client/System/Storage/Fixture/topseller_artifact.json')));
     $restClient->addSubscriber($mock);
     $this->artifactBackend->injectRestClient($restClient);
     $expectedArtifactCollection = new ArtifactCollection();
     $expectedArtifact = new TopsellerArtifact();
     $expectedArtifact->setData(array("2121121", "2121"));
     $expectedArtifactCollection->append($expectedArtifact);
     $genericArtifact = new GenericArtifact();
     $genericArtifact->setId("1");
     $genericArtifact->setTypeName("topseller");
     $actualArtifactCollection = $this->artifactBackend->getOne($genericArtifact);
     $this->assertEquals($expectedArtifactCollection, $actualArtifactCollection);
 }
 /**
  * @param GenericArtifact $genericArtifact
  * @return array|ArtifactCollection
  */
 public function getOne(GenericArtifact $genericArtifact)
 {
     return $this->getOneByTypeAndId($genericArtifact->getTypeName(), $genericArtifact->getId());
 }