public function testConstructorAndGetters() { $client = new Client(); $query = $client->createSelect(); $query->setQuery('test123'); $response = new Response('', array('HTTP 1.0 200 OK')); $result = new Result($client, $query, $response); $event = new PostCreateResult($query, $response, $result); $this->assertEquals($query, $event->getQuery()); $this->assertEquals($response, $event->getResponse()); $this->assertEquals($result, $event->getResult()); }
public function testCreateResultPostPlugin() { $query = new SelectQuery(); $response = new Response('', array('HTTP 1.0 200 OK')); $result = $this->client->createResult($query, $response); $expectedEvent = new PostCreateResultEvent($query, $response, $result); $expectedEvent->setDispatcher($this->client->getEventDispatcher()); $expectedEvent->setName(Events::POST_CREATE_RESULT); $observer = $this->getMock('Solarium\\Core\\Plugin\\Plugin', array('postCreateResult')); $observer->expects($this->once())->method('postCreateResult')->with($this->equalTo($expectedEvent)); $this->client->registerPlugin('testplugin', $observer); $this->client->getEventDispatcher()->addListener(Events::POST_CREATE_RESULT, array($observer, 'postCreateResult')); $this->client->createResult($query, $response); }