/** * @test */ public function canPostSynonym() { //$this->markTestIncomplete('Process error'); $this->synonymBackend = $this->getMock('\\Searchperience\\Api\\Client\\System\\Storage\\RestSynonymBackend', array('executePostRequest')); $this->synonymBackend->injectDateTimeService(new \Searchperience\Api\Client\System\DateTime\DateTimeService()); $restClient = new \Guzzle\Http\Client('http://api.searchperience.com/'); $mock = new \Guzzle\Plugin\Mock\MockPlugin(); $mock->addResponse(new \Guzzle\Http\Message\Response(201)); $restClient->addSubscriber($mock); $this->synonymBackend->injectRestClient($restClient); $expectsArgumentsArray = array('synonyms' => 'foo', 'mappedWords' => 'bla,bar', 'tagName' => 'one', 'type' => 'grouping'); $this->synonymBackend->expects($this->once())->method('executePostRequest')->with($expectsArgumentsArray, '/one')->will($this->returnValue($this->getMock('\\Guzzle\\Http\\Message\\Response', array(), array(), '', false))); $synonym = new Synonym(); $synonym->setSynonyms('foo'); $synonym->setMappedWords('bla,bar'); $synonym->setTagName('one'); $this->synonymBackend->post('one', $synonym); }
/** * @test */ public function canSetMappedWords() { $this->assertSame("", $this->synonym->getMappedWords(), 'Wrong initial state of words with same meaning of the synonym'); $this->synonym->setMappedWords("foo,bar"); $this->assertSame(2, count(explode(',', $this->synonym->getMappedWords())), 'Could not add words with same meaning to the synonyms'); }