コード例 #1
0
 public function testCreateRequestPostPlugin()
 {
     $query = new SelectQuery();
     $request = $this->client->createRequest($query);
     $expectedEvent = new PostCreateRequestEvent($query, $request);
     $expectedEvent->setDispatcher($this->client->getEventDispatcher());
     $expectedEvent->setName(Events::POST_CREATE_REQUEST);
     $observer = $this->getMock('Solarium\\Core\\Plugin\\Plugin', array('postCreateRequest'));
     $observer->expects($this->once())->method('postCreateRequest')->with($this->equalTo($expectedEvent));
     $this->client->registerPlugin('testplugin', $observer);
     $this->client->getEventDispatcher()->addListener(Events::POST_CREATE_REQUEST, array($observer, 'postCreateRequest'));
     $this->client->createRequest($query);
 }