public function testCreateQueryPostPlugin() { $type = Client::QUERY_SELECT; $options = array('optionA' => 1, 'optionB' => 2); $query = $this->client->createQuery($type, $options); $expectedEvent = new PostCreateQueryEvent($type, $options, $query); $expectedEvent->setDispatcher($this->client->getEventDispatcher()); $expectedEvent->setName(Events::POST_CREATE_QUERY); $observer = $this->getMock('Solarium\\Core\\Plugin\\Plugin', array('postCreateQuery')); $observer->expects($this->once())->method('postCreateQuery')->with($this->equalTo($expectedEvent)); $this->client->getEventDispatcher()->addListener(Events::POST_CREATE_QUERY, array($observer, 'postCreateQuery')); $this->client->createQuery($type, $options); }