/** * @depends testConstructorAndGetters * * @param PreCreateResult $event */ public function testSetAndGetQuery($event) { $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->setResult($result); $this->assertEquals($result, $event->getResult()); }
public function testCreateResultWithOverridingPlugin() { $query = new SelectQuery(); $response = new Response('test 1234', array('HTTP 1.0 200 OK')); $expectedEvent = new PreCreateResultEvent($query, $response); $expectedEvent->setDispatcher($this->client->getEventDispatcher()); $expectedEvent->setName(Events::PRE_CREATE_RESULT); $expectedResult = new Result($this->client, $query, $response); $test = $this; $this->client->getEventDispatcher()->addListener(Events::PRE_CREATE_RESULT, function (PreCreateResultEvent $event) use($test, $expectedResult, $expectedEvent) { $test->assertEquals($expectedEvent, $event); $event->setResult($expectedResult); }); $returnedResult = $this->client->createResult($query, $response); $this->assertEquals($expectedResult, $returnedResult); }